The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Simple question, but elusive to me. How would I define a new variable to be used in a template.
Say I wanted to use $aaron and have a new bit that would display "Aaron is AwesomE!" wherever I put that in my templates. In a similar vein, what if I wanted to use some PHP if/else to determine if a variable is set and if it is display it and if it is not, do not. An example of this would be in the postbit of my forum http://forums.livetheworship.com where I added $post[field7] (CD currently being played) to my postbit. I was trying to figure out how to test to see if a user set anything and if they did, display that variable and if they did not, then it would not display at all. Since I couldn't figure it out I had to settle on using (nothing) in my table for field7. Any ideas how to do these things. In Summary: 1. how Do I add a new bit and then use it in the template system? 2. How do I set a variable in PHP and then use it in the templates? Thanks. Aaron PS. If I can figure these simple things out, whole new worlds of mids will open up to me. |
#2
|
|||
|
|||
![]()
<?php
$variable = 'something'; ?> |
#3
|
|||
|
|||
![]()
new bit code:
<?php $bit = eval("all the template proccessing code, lookup form any file"); ?> |
#4
|
|||
|
|||
![]()
ummm....not sure what you mean. Sorry. I know PHP and I understand eval() but I don't know how you're saying to work this....mind explaining a bit more?
![]() Aaron |
#5
|
||||
|
||||
![]()
I am guessing you put the following after maybe if statement or something
Code:
eval("\$aaron = \"".gettemplate('aaron_template')."\";"); I am taking a shot in the dark here. |
#6
|
|||
|
|||
![]()
I'll try it again, but that's what I thought too and it didn't seem to work. I tried it with like something like $x = 1; without any kind of if/else statement....just plain hardcoded variable, and then did
PHP Code:
Aaron |
#7
|
|||
|
|||
![]()
LOL....
This SUCKS! Okay, This is what is in my showthread.php at the very end of the file: PHP Code:
PHP Code:
|
#8
|
||||
|
||||
![]()
I think this should be at the end of the file :
PHP Code:
Contents : Code:
CD I am Playing:</b><br>$post[field7] Satan |
#9
|
|||
|
|||
![]()
yeah I actually changed that in my php al;ready. Still doesn't work. And in the postbit, I am using $cdnow. Notice the $post[field7] deal is in comments...
Aaron |
#10
|
||||
|
||||
![]()
try using $post[cdnow] in your postbit. I doubt it matters, but
![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|