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 Inheritance, using "append" "prepend

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


Joined: 08 May 2010
Posts: 14

PostPosted: Sun Jan 06, 2013 12:44 pm    Post subject: Template Inheritance, using "append" "prepend Reply with quote

Hello guys,

is it possible to use the append or prepend tag in the php script (smarty api)?

such like this:

Code:

$this->smarty->display('extends:file:foo.tpl|file:append:bar.tpl);


the foo.tpl and the bar.tpl has both

Code:

{block name="content"}
...
{/block}


i will use this, maybe i have no appended file or i will change the order of the templates


Thanks.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Jan 06, 2013 6:44 pm    Post subject: Reply with quote

It's currently not possible and it does also not make sense as a general solution as append/prepend a attributes of specific {block} tags and child templates normally contain more than one {block} tags.
Back to top
View user's profile Send private message
ne0hype
Smarty Rookie


Joined: 08 May 2010
Posts: 14

PostPosted: Sun Jan 06, 2013 11:46 pm    Post subject: Reply with quote

Hello again.

perhaps i did not express myself properly...

relative to that post: http://www.smarty.net/forums/viewtopic.php?t=23956

i have that content block in the main template (index.tpl)

now i would have the opportunity to append or prepend another content.

both content templates have the same block tag
Code:
{block name="content"}
...
{/block}



when i use the opportunity to append another content file

Code:
$smarty->display('extends:index.tpl|file:content/content1.tpl|file:APPEND:content/content2.tpl');


smarty can identify from the appended content-file the name attribute- find the first and append them to that.

or do you have an other solution for that option?

ps: vielleicht kannst du (uwe) das ganze in der Deutsche Forum packen und auch auch deutsch anworten Smile
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Jan 07, 2013 7:53 pm    Post subject: Reply with quote

Ich habe schon Dein Request verstanden. Meist enthalten child templates mehrere {block} tags und die append/prepend Attribute müssen wie implementiert individuell vergeben werden können.

Du hast hier den Sonderfall das Deine child templates nur 1 {block} tag enthalten und Du möchtest nun das Attribute mit der File Spezifikation vergeben.

Leider können wir nicht jeden Sonderwunsch erfüllen.
Back to top
View user's profile Send private message
ne0hype
Smarty Rookie


Joined: 08 May 2010
Posts: 14

PostPosted: Tue Jan 08, 2013 12:05 pm    Post subject: Reply with quote

Hallo Uwe,

vielleicht kannst du mir sagen in welchen Dateien die Templates geladen und wo nach den Block-Tags gesucht wird. Vielleicht kann ich das selber umsetzten und ihr könnt es dann nachher im Git mergen... wenn ihr Git habt?..
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jan 08, 2013 7:28 pm    Post subject: Reply with quote

Das ist nicht so einfach zu realisieren, weil sich das vom Parsen von Template Namen bis in die Tiefen vom Inheritance Handling durchziehen würde. Da weiß ich gar nicht wo ich anfangen und aufhören sollte.

Mit Sicherheit würden wir dieses auch nicht mit ins Release übernehmen.
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