Subject: add to Caching Template Library wiki

Posted on: 26/12/13 01:37pm
By: ivy

http://wiki.geeklog.net/index.php/Caching_Template_Library

I can't search that theme var can be used in PHP as bellow.
e.g.
PHP Formatted Code
<?php
echo $this->get_var('title');
?>


and we can't use theme var in PHP comment out area.

e.g.
PHP Formatted Code
<?php
// {title}
?>


Re: add to Caching Template Library wiki

Posted on: 28/12/13 10:06am
By: Laugh

That should work as long as you put that php code in a template that can access that template variable. I can't remember if php is executed first but this may work as well:

PHP Formatted Code

<?php
echo '{title}';
?>
 



Re: add to Caching Template Library wiki

Posted on: 28/12/13 01:02pm
By: ivy

Tom

thanks!

However, this code does not work on my test site.

PHP Formatted Code
<?php
echo '{title}';
?>


error:
Parse error: syntax error, unexpected T_STRING in /xxx/data/layout_cache/english_utf-8/denim__databox__templates__data__test2__list_detail.php on line 105
or
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /xxx/data/layout_cache/english_utf-8/denim__databox__templates__data__test2__list_detail.php on line 105

Re: add to Caching Template Library wiki

Posted on: 28/12/13 02:29pm
By: Laugh

I am surprised this is not working

PHP Formatted Code

echo $this->get_var('title');
 


When testing php in templates (or doing any template modifications) you should make sure template caching is disable as you maybe viewing a cached file instead of the actual file.

Re: add to Caching Template Library wiki

Posted on: 28/12/13 06:55pm
By: ivy

PHP Formatted Code
echo $this->get_var('title');

It works correctly. but I can't find in Wiki.
So please add.

Re: add to Caching Template Library wiki

Posted on: 28/12/13 08:31pm
By: Laugh

I included a quick example in the Wiki under the PHP section.

Re: add to Caching Template Library wiki

Posted on: 31/12/13 04:38am
By: ivy

Thanks!

this notice is not needed?

notice: theme variable {xxxxx} can not be included in any comment area.
e.g.
<?php
// {xxxxx}
?>

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=95466