Log in

View Full Version : Help with calling a template from a function


GC-UK
01-30-2005, 07:31 PM
Sorry if this is the wrong place, or obvious, but it's been driving me mad :(

I want to be able to call a vb template from inside a function. But I cant get it to work. If I have this in a file alone, it works fine:

eval('print_output("' . fetch_template("FORUMHOME") . '");');

But if I put this instead



function testing()
{
eval('print_output("' . fetch_template("FORUMHOME") . '");');
}

testing();


The template comes out completely wrong. ALl the images, style etc. is missing, and only part of the template is drawn.

I cant work out what is wrong, any ideas? I'm guessing something more needs to be included in the function, but I cant find what that is.

Thanks a lot in advance for the help. I'm sure it's obvious, but I just cant work it out or find the answer anywhere else either :(

miz
01-30-2005, 07:53 PM
Sorry if this is the wrong place, or obvious, but it's been driving me mad :(

I want to be able to call a vb template from inside a function. But Icant get it to work. If I have this in a file alone, it works fine:

eval('print_output("' . fetch_template("FORUMHOME") . '");');

But if I put this instead



function testing()
{
eval('print_output("' . fetch_template("FORUMHOME") . '");');
}

testing();


The template comes out completely wrong. ALl the images, style etc. is missing, and only part of the template is drawn.

I cant work out what is wrong, any ideas? I'm guessing something moreneeds to be included in the function, but I cant find what that is.

Thanks a lot in advance for the help. I'm sure it's obvious, but I justcant work it out or find the answer anywhere else either :(


try do :


function testing()
{
global $bbuserinfo,$header,$footer,$headinclude,$stylevar ;
eval('print_output("' . fetch_template("FORUMHOME") . '");');
}

testing();

GC-UK
01-30-2005, 08:59 PM
Absoloutely perfect! I knew I was missing something, but wasn't sure what or where, thanks a lot! :)