Share » Forums » Setup & design » Setting and getting variables from...

Setting and getting variables from line.tpl

Setting and getting variables from line.tpl

Tuesday 25 April 2006 1:30:16 am - 2 replies

Modified on Tuesday 25 April 2006 1:32:19 am by Gunnar Birkeland

Author Message

Nabil Alimi

Tuesday 25 April 2006 3:11:33 am

Hi Gunnar,

Personnaly, I've never been able to use the "persistent_variable". (Ezpublish 3.6.4) Posted a thread about this a few weeks ago, no answers yet.

If you're line view is called within a loop, I suggest that you use a counter and each time you iterates you pass it to your template. Something like this for example.

{def $my_counter=0}
{foreach $my_line_array as $my_line}
{node_view_gui view=line content_node=$my_line my_counter=$my_counter} {*You pass your variable to your line.tpl, making it available into the template view. *}
{set scope=global $my_counter=inc( $my_counter )} {*Here you increment your counter *}
{/foreach}

And then you can easily retrive the $my_counter var into your line.tpl or in the overrride.

Hope it helped.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Gunnar Birkeland

Tuesday 25 April 2006 3:45:02 am

Hi Nabil.

Actually this apporach works just fine, but the case is that my line_log.tpl is not beeing called manually so it does not solve my problem with the persistent variable not beeing available in the line.tpl override.

I`ll go for your solution with the manual fetch and make an override for folder.tpl instead.

Thanks for your quick answer.

------------------------------------
Gunnar Birkeland
http://www.enternett.no

</major>
----------------------------
ez-version: 3.9.3.
PHP: 4.4.2-1
MYSQL: 4.0.24

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu