Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 07:19 am EDT

Geeklog Forums

how do I get a template variable that is not set to not display this: {myvar}


joel goldstick

Anonymous
I am using Geeklog v 1.3?. Some of my pages have certain variables set, but others don't. They all use a master header.thtml, and although I believe there is a setting in the template code that ignores undefined variables, I think I have it set correctly.

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The option for unknown variables can have one of three values: "keep" (so that they show up when not set), "remove", and "comment" (i.e. keep them as comments in the HTML source, but they won't be visible).

The default it "remove". However, that will only come into effect when you call the finish() method for a template. We had a few places in Geeklog (until recently) where we called parse() but not finish(), and so the undefined variables were not removed.

bye, Dirk
 Quote

Joel Goldstick

Anonymous
My code fragment:
Text Formatted Code

...
...
$display .= COM_endBlock();
$display .= COM_siteFooter();
echo $display;
 


So, where would I go to invoke finish()
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Okay, maybe I misunderstood your question then. Are you trying to define your own variables? In one of Geeklog's templates or in one of your own?

To add your own variables to (some) of Geeklog's templates, there's the CUSTOM_templateSetVars function (in lib-custom.php), but that was only introduced around Geeklog 1.4.0.

bye, Dirk
 Quote

All times are EDT. The time is now 07:19 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