Hi,
I want to extend my template. I have $conf['test'] = "Hello World!" in my local configuration.
What can I use to access this variable in a .tpl file?
Thank you!
Piwigo version: 2.9.4
Offline
reisi007 wrote:
Hi,
I want to extend my template. I have $conf['test'] = "Hello World!" in my local configuration.
What can I use to access this variable in a .tpl file?
Thank you!
Piwigo version: 2.9.4
You should do something like the following code :
$template->assign('my_conf_test_variable', $conf['test']);
And you can of course choose the key you want for your variable instead of my_conf_test_variable
Last edited by nicolas (2018-11-25 20:07:13)
Offline
Hi,
Thanks for your answer.
This seems to work, but my_conf_test_variable is not printed. Can you please assist in how to print this variable, which contains HTML tags..?
The solutions I found didn't work...
Offline
reisi007 wrote:
Hi,
Thanks for your answer.
This seems to work, but my_conf_test_variable is not printed. Can you please assist in how to print this variable, which contains HTML tags..?
The solutions I found didn't work...
You add the smarty tag :
{$my_conf_test_variable}
Offline
Hi,
Thanks for your reply, but I did this as told. Here my code
add_event_handler('loc_end_element_set_unit', 'reisisot_mainpage'); function reisisot_mainpage(){ global $template; $test = '<p>Hallo!</p>'; $template->assign('reisishotMainpagetext', $test); }
I also tried it with add_event_handler('combinable_preparse' ...
My template code is:
{$reisishotMainpagetext} <!-- Test 2 {if isset($reisishotMainpagetext)} VAR IS SET {else} VAR IS NOT SET {/if}-->
The text, which is printed in the HTML is:
<!-- Test 2 VAR IS NOT SET -->
Thanks for your help!
Last edited by reisi007 (2018-11-26 22:08:06)
Offline
probably not the right event
mainpage_categories.tpl
loc_end_index_category_thumbnails
thumbnails.tpl
loc_end_index_thumbnails
etc
Offline
@flop25: Is there a list with all events?
PS: this code is in the index.tpl file
Last edited by reisi007 (2018-11-26 22:13:57)
Offline
yourpiwigo/tools/triggers_list.php
Offline
Thanks for providing me with the list of all triggers.
Using
loc_begin_index
everything works like a charm.
Offline