PDA

View Full Version : get template function


matthew tucker
02-07-2003, 11:21 AM
I'm sure this is really simple.

I'm trying hard to get my head around the gettemplate function, how it works with $variables and the template code.

for example what exactly does

eval( '$statistics = "' . gettemplate( 'home_statistics' ) . '";' );

mean?? Am I right in thinking that its simply assigning to $statistics the code in the template 'home_statistics'? Hmm probably yes.

but how do I then pass another variable, say, $info to the template so that its value appears in $statistics? Or don't I have to do anything explicit? Are all PHP variables globally visible?

is there a thread somewhere with a quick tutorial on this? I'm getting really confused.

Xenon
02-07-2003, 11:44 AM
gettemplate('home_statistics') just gets the tempölate home_statistics out of the db.
it's just a string then.

the eval means, that the string gets parsed as it would be in real php files, that's how the variables get parsed.

you can use every variable in your template which is defined in your calling function (-> every var you can access in this function can also be used in the template)

matthew tucker
02-08-2003, 06:10 AM
Thank you Xenon, that is very clear. A great help.

Matthew

Xenon
02-08-2003, 04:15 PM
np, you're welcome :)