Welcome to Geeklog Sunday, October 25 2020 @ 08:36 pm EDT

Geeklog Forums

add to Caching Template Library wiki


Status: offline

ivy

Forum User
Full Member
Registered: 25/11/04
Posts: 313
Location:Tokyo Japan
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}
?>


Geeklog Japan https://www.geeklog.jp
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1403
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}';
?>
 



One of the Geeklog Core Developers.
 Quote

Status: offline

ivy

Forum User
Full Member
Registered: 25/11/04
Posts: 313
Location:Tokyo Japan
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
Geeklog Japan https://www.geeklog.jp
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1403
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.
One of the Geeklog Core Developers.
 Quote

Status: offline

ivy

Forum User
Full Member
Registered: 25/11/04
Posts: 313
Location:Tokyo Japan
PHP Formatted Code
echo $this->get_var('title');

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

Geeklog Japan https://www.geeklog.jp
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1403
I included a quick example in the Wiki under the PHP section.
One of the Geeklog Core Developers.
 Quote

Status: offline

ivy

Forum User
Full Member
Registered: 25/11/04
Posts: 313
Location:Tokyo Japan
Thanks!

this notice is not needed?

notice: theme variable {xxxxx} can not be included in any comment area.
e.g.
<?php
// {xxxxx}
?>
Geeklog Japan https://www.geeklog.jp
 Quote

All times are EDT. The time is now 08:36 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content