The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Very Easy Request
I have a javascript that loads when the page loads. I would like the user to be able to turn it on or off. That is, i want the user to have the option of the script loading when the page loads, or not loading.
How i'd like to do it, is to either use a cookie, or a field in the database to store a value, that says whether or not the script should run when the page loads. I imagine the cookie would be easier. Can anyone give me a general idea of what to do? or help me out with some php that does something like that? |
#2
|
||||
|
||||
How about this:
Create a new userprofile field in Admin CP hidden in profile but editable by the users, note its id Tell your users to enter "YES" there if they want to load the script. Then edit global.php, find: PHP Code:
PHP Code:
Then you can use "$yourjavacode" variable in your relavant template like header.. |
#3
|
|||
|
|||
it doesn't seem to parse $yourjavacode. it just leaves "$code" in the page, without it being replaced by the actual code.
what it thought of, is it might be my code that i'm trying to replace it with... the necessary java code is onLoad="snow()"... so it looked like if (strtolower($bbuserinfo[field6])=='yes') {$yourjavacode='onLoad="snow()"';} Should i do it differently? is that the problem? |
#4
|
|||
|
|||
No need to hack; I mean you just referenced PHPinclude...install this first (I can never remember the eval template code) and then add this:
PHP Code:
|
#5
|
||||
|
||||
Quote:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|