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

include_php problem

 
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
whoda
Smarty n00b


Joined: 09 Sep 2004
Posts: 3

PostPosted: Wed Oct 27, 2004 8:03 am    Post subject: include_php problem Reply with quote

hallo,

ich habe ein problem mit den includieren einer php-datei in einen template.

also ich habe eine index.php, in dieser rufe ich das template header.tpl auf und zum schluss footer.tpl.

in der datei header.tpl möchte ich nun die datei menu.php aufrufen, die wiederrum das template menu.tpl abarbeitet.

lasse ich mir nun die seite index anzeigen, kommt an der stelle, wo das menü erscheinen sollte
Fatal error: Call to a member function assign() on a non-object in der menu.php

Wie kann ich das problem beheben! ich habe jetzt schon mit fetch und {php}include (menu.php){/php } und include_ php gearbeitet, hatte aber noch keinen erfolg.

besten dank für eure hilfe schon jetzt
whoda
Back to top
View user's profile Send private message
b166-er
Smarty Rookie


Joined: 22 Oct 2004
Posts: 29
Location: Germany, Wiesbaden

PostPosted: Fri Oct 29, 2004 9:23 pm    Post subject: Reply with quote

hi,

versuch doch mal die menu.php in der index.php zu includen, und das resultat an deine header.tpl & menu.tpl zu uebergeben....
________
Ford do brasil history


Last edited by b166-er on Sun Feb 13, 2011 6:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Sat Oct 30, 2004 7:02 pm    Post subject: Re: include_php problem Reply with quote

whoda wrote:
hallo,

ich habe ein problem mit den includieren einer php-datei in einen template.

also ich habe eine index.php, in dieser rufe ich das template header.tpl auf und zum schluss footer.tpl.

in der datei header.tpl möchte ich nun die datei menu.php aufrufen, die wiederrum das template menu.tpl abarbeitet.

lasse ich mir nun die seite index anzeigen, kommt an der stelle, wo das menü erscheinen sollte
Fatal error: Call to a member function assign() on a non-object in der menu.php

Wie kann ich das problem beheben! ich habe jetzt schon mit fetch und {php}include (menu.php){/php } und include_ php gearbeitet, hatte aber noch keinen erfolg.

besten dank für eure hilfe schon jetzt
whoda


hört sich so an, als wäre dein Template-Object (sprich Smarty-Obj) an dieser Stelle des Scripts noch nicht/nicht mehr vorhaden
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Sat Oct 30, 2004 10:13 pm    Post subject: Re: include_php problem Reply with quote

whoda wrote:
lasse ich mir nun die seite index anzeigen, kommt an der stelle, wo das menü erscheinen sollte
Fatal error: Call to a member function assign() on a non-object in der menu.php


innerhalb von {php} oder {include_php} sind keine globalen variablen sichtbar. das smarty object heisst hier $this.

du solltest {php} und {include_php} generell vermeiden und nur im absolut alleralleräußersten notfall verwenden.
besser ist auf plugin-funktionen auszuweichen. siehe z.b. http://smarty.php.net/manual/de/tips.componentized.templates.php
(ist meine persönliche meinung. andere haben andere. Smile )
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Schaelle
Smarty Rookie


Joined: 28 Jun 2004
Posts: 12
Location: Germany, Leipzig

PostPosted: Sun Dec 19, 2004 10:42 am    Post subject: Reply with quote

Hmm, messju hast du nicht einen Link zu einer Plugin Erklärung, da dein Link ja zu ner Seite geführt wird, wo einem Empfohlen wird das zunutzen.

Gruß,
Schaelle
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Mon Dec 20, 2004 8:34 am    Post subject: Reply with quote

Schaelle wrote:
Hmm, messju hast du nicht einen Link zu einer Plugin Erklärung, da dein Link ja zu ner Seite geführt wird, wo einem Empfohlen wird das zunutzen.


ja, hab ich:
http://smarty.php.net/manual/de/

scnr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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