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

Template mit Smarty-Tags in Template einfügen

 
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
Bazooka
Smarty Rookie


Joined: 19 Jul 2004
Posts: 7

PostPosted: Mon Jul 19, 2004 1:21 pm    Post subject: Template mit Smarty-Tags in Template einfügen Reply with quote

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
View user's profile Send private message
messju
Administrator


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

PostPosted: Mon Jul 19, 2004 2:23 pm    Post subject: Reply with quote

hallo,

was du suchst ist {include} nicht {include_php}.

gruß
messju
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: Tue Jul 20, 2004 6:06 am    Post subject: Re: Template mit Smarty-Tags in Template einfügen Reply with quote

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
View user's profile Send private message
Bazooka
Smarty Rookie


Joined: 19 Jul 2004
Posts: 7

PostPosted: Tue Jul 20, 2004 8:09 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


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

PostPosted: Tue Jul 20, 2004 8:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Bazooka
Smarty Rookie


Joined: 19 Jul 2004
Posts: 7

PostPosted: Tue Jul 20, 2004 9:56 am    Post subject: Reply with quote

Vielen Dank messju, jetzt klappt es!

Gruß
Bazi
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