|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Bazooka Smarty Rookie
Joined: 19 Jul 2004 Posts: 7
|
Posted: Mon Jul 19, 2004 1:21 pm Post subject: Template mit Smarty-Tags in Template einfügen |
|
|
Hi,
ich habe mehrere Smarty-Templates, dort kommt teilweise immer der gleiche Block vor:
<smarty: section name=counter loop=$smarty.session.block/>
<table><tr><td>blabla</td></tr>
<smarty: if blabla... /><tr><td>blabla</td></tr><smarty: /if />
</table>
<smarty: /section />
Nun muss ich wenn sich dort was ändert, das in allen Templates ändern, also würde ich gerne diesen Block nochmal in ein eigenes Template auslagern.
Ich habe nun an die Stelle wo der Block vorkommt folgenden Tag gesetzt:
<smarty: include_php file="pfad/zum/block.tpl.html"/>
und in block.tpl.html den oberen Block geschrieben.
Leider werden die Smarty-Tags im Block gar nicht ausgeführt, was mache ich falsch und was muss ich tun damit es funktioniert?
Gruß
Bazi |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jul 19, 2004 2:23 pm Post subject: |
|
|
hallo,
was du suchst ist {include} nicht {include_php}.
gruß
messju |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Tue Jul 20, 2004 6:06 am Post subject: Re: Template mit Smarty-Tags in Template einfügen |
|
|
Bazooka wrote: |
<smarty: section name=counter loop=$smarty.session.block/>
<smarty: /section />
|
Ist dies eine alternative schreibweise zu
Quote: |
{ section name=counter loop=$smarty.session.block }
{ /section }
|
???
oder hat er einfach nur die falschen Tags verwendet? |
|
Back to top |
|
Bazooka Smarty Rookie
Joined: 19 Jul 2004 Posts: 7
|
Posted: Tue Jul 20, 2004 8:09 am Post subject: |
|
|
Danke für die Antworten
@messju
Das habe ich auch versucht, nur wenn ich aus include_php include mache, bekomme ich folgenden Fehler:
Warning: Smarty error: unable to read template resource: "pfad/zum/block.tpl.html" in c:\programme\apache group\apache\pfad\zu\smarty\Smarty.class.php on line 999
Aber der Pfad müsste ja stimmen, zumindest findet smarty das Template ja bei der anderen Schreibweise oder muß man das noch irgendwo definieren?
@kills
Ich denke mal das ist die xml-schreibweise, jedenfalls funktioniert das im prinzip alles.
Gruß
Bazi |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jul 20, 2004 8:48 am Post subject: |
|
|
Bazooka wrote: | @messju
Das habe ich auch versucht, nur wenn ich aus include_php include mache, bekomme ich folgenden Fehler:
Warning: Smarty error: unable to read template resource: "pfad/zum/block.tpl.html" in c:\programme\apache group\apache\pfad\zu\smarty\Smarty.class.php on line 999
Aber der Pfad müsste ja stimmen, zumindest findet smarty das Template ja bei der anderen Schreibweise oder muß man das noch irgendwo definieren?
|
nein. templates werden in $smarty->template_dir gesucht, php files in phps include_path.
Quote: | @kills
Ich denke mal das ist die xml-schreibweise, jedenfalls funktioniert das im prinzip alles. |
siehe: http://smarty.php.net/manual/en/variable.left.delimiter.php und http://smarty.php.net/manual/en/variable.right.delimiter.php |
|
Back to top |
|
Bazooka Smarty Rookie
Joined: 19 Jul 2004 Posts: 7
|
Posted: Tue Jul 20, 2004 9:56 am Post subject: |
|
|
Vielen Dank messju, jetzt klappt es!
Gruß
Bazi |
|
Back to top |
|
|
|
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
|