Log in

View Full Version : Varibles


---MAD---
04-04-2008, 01:42 PM
Hi there,

If a variable is created in a php file, how can I tell a template where to find what the variable is meant to do?

IE.

$mad

$mad is assigned in mad.php, how, in a template such as navbar_link, would I get this information from mad.php?

Thanks

EnIgMa1234
04-04-2008, 01:58 PM
Make a plugin and use hooks to achieve this.

---MAD---
04-04-2008, 02:50 PM
What hook location would I select? Would I put the contents of mad.php into the plugin?

Opserty
04-04-2008, 05:15 PM
If the template is fetched on the same page as that in which $mad is defined then you can type $mad directly into your template.

---MAD---
04-04-2008, 06:09 PM
Thats the thing, its not. navbar_link is used on every vb page.

Dismounted
04-05-2008, 09:52 AM
You need to create & assign data to the variable before the template is parsed.

---MAD---
04-05-2008, 12:06 PM
I know but how do I do this..?

Opserty
04-05-2008, 12:16 PM
Create a Plugin on the page on which the template is parsed. For something displayed on all pages, global_start would be best.