|
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 |
ne0hype Smarty Rookie
Joined: 08 May 2010 Posts: 14
|
Posted: Sun Jan 06, 2013 12:44 pm Post subject: Template Inheritance, using "append" "prepend |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Jan 06, 2013 6:44 pm Post subject: |
|
|
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 |
|
ne0hype Smarty Rookie
Joined: 08 May 2010 Posts: 14
|
Posted: Sun Jan 06, 2013 11:46 pm Post subject: |
|
|
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 |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Jan 07, 2013 7:53 pm Post subject: |
|
|
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 |
|
ne0hype Smarty Rookie
Joined: 08 May 2010 Posts: 14
|
Posted: Tue Jan 08, 2013 12:05 pm Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jan 08, 2013 7:28 pm Post subject: |
|
|
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 |
|
|
|
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
|