MyBB Community Forums

Full Version: [SOLVED] Variable doesn't show in template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I'm probably making an obvious mistake but I simply fail to spot it so maybe you guys can help me out on this.
I've been modifying a plugin and added a new variable to it. This all works correctly, if I echo the variable from the php file it comes out allright. But since I want to put it into a special place on my page, echo or outprint is not enough.

So I eval the variable like this:
eval("\$boxstyle = \"".$templates->get('as_boxstyle')."\";");

I have a template called as_boxstyle and in this template I call the variable like this:
{$boxstyle} test
(the test is just to see if the template shows)

However all I geht is the "test", the value of the variable doesn't show.

Ideas anyone? Huh

LG
Senya
Have you set your variable global before that?

global $db, $mybb, $boxstyle;
Oh. Nope. I wasn't aware that I had to. Blush

Now I can even use the variable just like that without the eval which is awesome! Thank you soooo much! Big Grin

--- SOLVED ---