Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

[HELP] {php} {include_php} – externe PHP Scripte includen

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
MoR4euZ
Smarty Rookie


Joined: 30 Jun 2004
Posts: 5

PostPosted: Thu Aug 26, 2004 11:24 am    Post subject: [HELP] {php} {include_php} – externe PHP Scripte includen Reply with quote

[HELP] {php}{include_php} – externe PHP Scripte includen

Hallo

Ich verwende das CMS Content-Builder (http://www.content-builder.de) was Smarty nutz

Ich würde gerne externe PHP Scripte in den Contentbereich laden

aber es wird nicht abgearbeitet nur das test echo ganz am Schluss wird ausgegeben :/

http://web5.208080.vserver.de/index.php?load=article2&;sub=full&id=3&app=contact


Code:

{php}
switch ($app) {
case "contact":
include("modules/contact/contact.php");
break;
}
echo "test";
{/php}


Code:

{php}
switch ($app) {
case "contact":
include("modules/contact/contact.php");
break;
}
echo $app;
{/php}


kommt bei beiden zu keiner Ausgabe

{include_php file="modules/contact/contact.php"} klappt ohne Probleme

Kann ich mit der Smarty Syntax eine IF basteln und das {include_php} dort einbringen?

nun bleibt die frage warum das PHP switch nicht abgearbeitet wird oder ob wer noch eine bessere (saubere) Lösung für mich parat hat Smile

Ich hoffe ich habe mein Problem gut genug beschrieben das man es verstehen kann


Gruß

MoR4euZ
Back to top
View user's profile Send private message Visit poster's website
Dolgan
Smarty Rookie


Joined: 24 Aug 2004
Posts: 8

PostPosted: Thu Aug 26, 2004 11:46 am    Post subject: wahrscheinlich ne leere Variable... Reply with quote

Hallo,

wenn das "test" beim ersten ausgegeben wird,
beim echo von $app aber nix, würd ich spontan mal annehmen, daß $app aus irgendeinem Grund leer ist. Dann würde natürlich auch dein case nicht matchen und logischerweise nix eingebunden.
Wenn Du trotzdem glaubst, daß Dein switch-Konstrukt nicht abgearbeitet wird, kannst Du's ja mal mit ner zusätzlichen
[php:1:fcfe3ac36f]
switch ($app) {
[...]
default:
echo "Da scheint was schief zu laufen. \$app = $app.";
}
[/php:1:fcfe3ac36f]
nochmal testen.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Aug 26, 2004 12:08 pm    Post subject: Reply with quote

ich tippe mal $app ist eine globale variable. wenn du die in {php} oder {include_php} verwenden willst, dann must du sie global declarieren.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MoR4euZ
Smarty Rookie


Joined: 30 Jun 2004
Posts: 5

PostPosted: Thu Aug 26, 2004 12:21 pm    Post subject: Reply with quote

ausgabe ist jetzt

Code:
 Da scheint was schief zu laufen $app = .


also scheint $app wirklich leer zu sein
aber wieso ???

ich benutze das switch so wie hier schön länger und es hat noch nie probleme damit gegeben Smile
Back to top
View user's profile Send private message Visit poster's website
Dolgan
Smarty Rookie


Joined: 24 Aug 2004
Posts: 8

PostPosted: Thu Aug 26, 2004 12:23 pm    Post subject: Reply with quote

Das Problem ist auch nicht das switch, sondern $app.
Aus irgendeinem Grund ist die leer. Hast Du messjus Tipp
schon ausprobiert?
Wie auch immer: offensichtlich liegt das Problem auserhalb des von Dir
geposteten Codes. Wenn Du also weiter Hilfe brauchst, bruachen wir mehr
Code.
Back to top
View user's profile Send private message
MoR4euZ
Smarty Rookie


Joined: 30 Jun 2004
Posts: 5

PostPosted: Thu Aug 26, 2004 12:34 pm    Post subject: Reply with quote

messju wrote:
ich tippe mal $app ist eine globale variable. wenn du die in {php} oder {include_php} verwenden willst, dann must du sie global declarieren.


wie kann ich die variable global declarieren ?
sorry meine php kentnisse sind nicht die besten Smile
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Aug 26, 2004 1:29 pm    Post subject: Reply with quote

MoR4euZ wrote:
wie kann ich die variable global declarieren ?


http://php.net/variables.scope
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Aug 30, 2004 6:45 am    Post subject: Reply with quote

Ich würde auf register_globals tippen!

hm ich denke du könntest es so lösen:

[php:1:7ac72dd970]
{php}
switch ($_GET["app"]) {
case "contact":
include("modules/contact/contact.php");
break;
}
echo $app;
{/php}
[/php:1:7ac72dd970]
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP