The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Why is it that some variables are global and some are not? I understand that you may think
that a particular variable will not be used within a certain template but that kind of limits vb's well know customisability. Well for those that cant write plugins.. like me. I just want to make the simplest of changes but find that i cant because the variable does not work within the template i am using. Ive come across this problem time and time again, i hope there will be a simple solution to this in the near future or at the very least an easy to follow guide to making a variable global. Just in case you were wondering wich variable im having an issue with... i want to use $thread[views] within the postbit_attachment template. |
#2
|
||||
|
||||
![]()
When a template is called by a function or a class or both, it's in the local scope of that function or class. Variables created outside of that scope aren't usable without using a global call.
My first suggestion is to make a plugin on the hook 'postbit_display_start' containing the following: PHP Code:
|
#3
|
|||
|
|||
![]()
Try $threadinfo.
|
#4
|
|||
|
|||
![]()
Thank you link for your advise about using a plugin but unfortunatly i have no clue where to start with creating a plugin, i can istall them without issue but actually making them is another thing.
Thank you Marco for your suggestion to use $threadinfo but im afraid that didnt work.. i got nothing at all. This is the point im making.. i apreciate what link said about globals and im sure to a select few that may have made alot of sense but to non coders (with little free time to learn) it makes doing the simplest of thing sometimes very tricky and often costing money to get someone else to do it. Perhaps sometime in the future there might be a way around this for the elderly members ![]() |
#5
|
||||
|
||||
![]()
Link: That won't work because $thread is already globalized in postbit, just not in postbit attachments.
Also, the variable is indeed $thread and not $threadinfo Your best bet is globalizing the variable in the post attachments bit hook. postbit_attachment And from there you can use good old PHP Code:
|
#6
|
|||
|
|||
![]()
hI Giovanni and thankyou for your input.. but... I know.. that you know.. that i know... nothing about writing plugins :erm:
So sadly im still at square one. Is globalising a variable an easy operation? Can this be used for all variables? |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|