Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 08:37 am EDT

Geeklog Forums

add to Caching Template Library wiki


Status: offline

ivy

Forum User
Full Member
Registered: 11/25/04
Posts: 314
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.
Text Formatted Code
<?php
echo $this->get_var('title');
?>


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

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


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

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
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:

Text Formatted Code

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



One of the Geeklog Core Developers.
 Quote

Status: offline

ivy

Forum User
Full Member
Registered: 11/25/04
Posts: 314
Location:Tokyo Japan
Tom

thanks!

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

Text 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: 09/27/05
Posts: 1468
Location:Canada
I am surprised this is not working

Text 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: 11/25/04
Posts: 314
Location:Tokyo Japan
Text 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: 09/27/05
Posts: 1468
Location:Canada
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: 11/25/04
Posts: 314
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:37 am.

  • 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