Forums / Setup & design / Setting and getting variables from line.tpl

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Setting and getting variables from line.tpl

Author Message

Gunnar Birkeland

Tuesday 25 April 2006 1:30:16 am

Hi, i got an override for line.tpl that creates a table for each instance of a post in a logbook.

Now what i want to do is almost too simple, but the problem is large at hand. I want to increase a parameter (preferably persistent_variable) for each time a table is created, a counter if u wish.

Now, <i>setting</i> the persistent_variable is no problem, but is there a way i can <i>fetch</i> it in line.tpl?

This works fine: {set scope=global persistent_variable=1}
But not this: {$module_result.content_info.persistent_variable}

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

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

Nabil Alimi

Tuesday 25 April 2006 3:11:33 am

Hi Gunnar,

Personnaly, I've never been able to use the "persistent_variable". (Exponential 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