The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Calling functions / declaring with eval
I am looking for a solution for hours now but none of the forum postings were able to help me, neither here nor on vbulletin.com..
All i want to do is simply declare a new variable called $medals which can be used in the Postbit template. The content of this $medals will be something like $medals = getMedals($uid,another_param); So, i am aware that you cannot execute php-code in templates. What i am looking for is the procedure how to make this $medal a valid variable in the Postbit-Template. I have read about adding another templates and eval'ing some code but i am a bit confused actually. I am not sure why i should add a new template which can not hold any php-code anyways to eval something with its content. I tried a few things like adding stuff to phpinclude or global.php but its not doing the magic, so if i have to modify anything, please let me know the appropriate position within the php-file. Thanks for you help! -act PS: just noticed that its basically similiar to that ONLINE/OFFLINE-Images you are showing here in the postings beneath the Username. So if you can explain me how to implement those, it will probably help me with my problem as well. |
#2
|
||||
|
||||
Just stick that line of code (with getMedals() and all) in functions.php, inside the getpostbit() function. For $uid use $post['userid'].
|
#3
|
|||
|
|||
Thanks FireFly for saving my day .. works perfect!
-act |
#4
|
|||
|
|||
additional question, but same matter.
I would also like to use those variable stated above in the profile display screen. I found the the function getuserinfo () with the getinfo-section in the functions.php, but when adding Code:
global $userawards; $userawards=getUserAwards($userid],true); Greets -act |
#5
|
||||
|
||||
I believe getuserinfo() is first called in sessions.php before the phpinclude template is eval()'ed, so the function is not yet defined in that stage. Move the function definition to functions.php or just user it in member.php (I suggest the latter, since you don't want to getUserAwards() every time a user info is called for).
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|