View Full Version : How to use a PHP variable in a template
Borisch
03-25-2006, 02:21 PM
Hey, I'm just starting to modify my vB setup and I've got this very basic question, which I presume will have be very easy to answer.
Say I declare a variable in my new custom PHP page like so:
$myVariable = 1;
How do I use this in my template? Simply slapping $myVariable in a span doesn't work, eval() barfs on it and won't let me save the template.
Try using this instead:
{$myvar}
Borisch
03-25-2006, 02:29 PM
Brad, you're my knight in shining armor! =)
Just using $bbuserinfo[username] works for showing the username though, is this because it's a global variable?
Great signature by the way.
It's just something odd I've noticed in 3.5, wrapping the var or array in the {} tend to make it show if it doesn't by itself.
Borisch
03-25-2006, 02:49 PM
Heh, odd indeed. Well, I tip my hat in gratitude for you Sir and bid you a good day!
White_Snake
04-03-2006, 04:01 PM
im having the same problem as Borisch, but i cant make the variable to show even if i wrap it with the "{}" i dont know what im doing wrong, the variables are also pre defined text based on a if conditional
Dannyboy1
10-09-2006, 04:35 PM
Anyone? Ideas?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.