PDA

View Full Version : Declaring variables within a template


The Cat!
02-09-2008, 06:05 PM
I can't seem to declare a variable within a template.

If I wanted to say $name="Bob" in a template, how

would I go about it? Sorry all, I am a newbie at coding

but everybody has to start somewhere :)

Lynne
02-09-2008, 06:08 PM
You cannot use php within a template. If you want to declare a variable to be used in a template, you need to add a plugin that uses a hook within that php page. The hook you use depends on where you want to use that variable. If you give us a bit more information on what you want to do, we may be able to make suggestions on which hook to use.

The Cat!
02-09-2008, 06:19 PM
I am trying to build the famous "multiple sites with common forum",

and I am soooo close to success... What I am trying to do is change

the url of the last post within a certain forum (forum #35) in forumhome_lastpostby

Basically, I am trying to say - if $forumid = '35' then $urll = "site2.com"

else $urll = "site1.com" ($urll is the variable)

And I know nothing about plugin and hook... LOL

--------------- Added 1202597443 at 1202597443 ---------------

After investigating the plugin and hook system, I have

written the proper code to make this work. Thank you

Lynne for getting me going in the right direction.