Log in

View Full Version : "Fetching" multiple templates?


Deaths
02-20-2005, 04:54 PM
I basicly have a couple of "module" which I want to show in the navbar.
However, this is partly template based...

When I call a template the way I know eval('print_output("' . fetch_template it just calls 1 template, and not the other ones.

What's the command for calling a template in a way that I can still call the final template?

Help would be appreciated, hoping for a quick reply :)

Zachery
02-20-2005, 04:57 PM
eval('print_output("' . fetch_template
becomes

eval('$var("' . fetch_template

;)

Deaths
02-20-2005, 04:58 PM
EDIT:
It just returns a blank page for me :-/.

Could you maybe post a brief example on how I should this code?

Thanks

deathemperor
02-21-2005, 09:13 AM
print_output means after reading that line it will stop doing anything after that line to print out the template in its param.

so before print_output you just have to code:

eval('$something = "' . fetch_template('template_name') . '";');

just use it as many times as you want to create the templates, and of course it can only be used within the template feched by print_output.

hope I made myself clear.

Jolten
02-21-2005, 09:46 AM
I'm assuming you have one template as a main container and your other templates would be internal nested templates....

Basically.. use

eval('$var = "' . fetch_template('template_name') . '";');


Throughout your code. Then in the main template include $var where you want the internal templates to appear. Then call the master template at the end of the php file with

eval('print_output("' . fetch_template ...

Deaths
02-21-2005, 06:14 PM
I understand the print_output part, as I am no noob to PHP.

What I did not understand, was if I have to define the $var, and if so, what should it contain, etc...

Zachery
02-21-2005, 06:21 PM
I understand the print_output part, as I am no noob to PHP.

What I did not understand, was if I have to define the $var, and if so, what should it contain, etc...


eval('$var = "' . fetch_template('template_name') . '";');

$var as in a $varible. like lets say you want to use the postbit template once


eval('$postbit = "' . fetch_template('postbit') . '";');


Now you can use $postbit in the template you are printing.

Guest190829
02-21-2005, 07:01 PM
What I did not understand, was if I have to define the $var, and if so, what should it contain, etc...

No, you don't have to define $var as it's being define with fetch templates as whatever template you want to use. As Zachery said you would then you $var in your "main" template.

Deaths
02-22-2005, 08:51 AM
eval('$var = "' . fetch_template('template_name') . '";');

$var as in a $varible. like lets say you want to use the postbit template once


eval('$postbit = "' . fetch_template('postbit') . '";');


Now you can use $postbit in the template you are printing.
Ah, I see.

So, basicly, in the main template, I can use the $var which I used to "fetch" the template?

I can't try it now, but I think I understood it, thanks.

Zachery
02-22-2005, 01:23 PM
Ah, I see.

So, basicly, in the main template, I can use the $var which I used to "fetch" the template?

I can't try it now, but I think I understood it, thanks.
Yeap :)