The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Pass a vBulletin variable to Javascript?
Hi
I had a jquery slideshow which is working through js file called preview.js I have in this js file width & height for the slideshow and I would like to add a variable in the slideshow that if I from admincp edited the width to specific size then change and if not keep it as a specific size I want to remain I found this thread but for vb4 any suggestion for vb3? https://vborg.vbsupport.ru/showthread.php?t=264472 I'm really interesting in this therefore if any one by any chance would help me I will appreciate that I have attached the jquery js file hope you could add a variable to it as in the thread for vb4 and you will find the width and height in fourth line so just make your edit please and then how to make the code in the global_start hook waiting... thank you |
#2
|
|||
|
|||
I think you just need to create your admincp option, then put something like this in the headinclude template:
Code:
<script type="text/javascript"> <!-- var slideshow_width = $vboptions['slideshow_width']; // --> </script> then use slideshow_width in your jx file. |
Благодарность от: | ||
Honourable |
#3
|
|||
|
|||
The problem it doesnt work
what because it's jquery file not straight away a code on the page and moreover I did what you have told me but nothing happens? --------------- Added [DATE]1327097665[/DATE] at [TIME]1327097665[/TIME] --------------- moreover it gives me Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/lywomen/public_html/test/includes/adminfunctions_template.php(3942) : eval()'d code on line 8 in 3.8.7 |
#4
|
|||
|
|||
Hmm...OK, try this instead:
Code:
<script type="text/javascript"> <!-- var slideshow_width = parseInt("$vboptions[slideshow_width]", 10); // --> </script> |
#5
|
|||
|
|||
Hey kh99
I really addore you ^^ but the problem the slides appear abnormall like I did the size is 610 for width I felt like the java count it as 100% not pixel? am I correct? |
#6
|
|||
|
|||
I don't know. Are you putting slideshow_width in place of the 610 in your js file? It seems like that should work.
|
#7
|
|||
|
|||
the problem is from the code
because when I changed the size directly from js file it works fine? but when I change it through the vbulletin it doesnt work probably and I THOUGHT BECAUSE IT GOES THROUGH THE CODE AND THERE IS SOMETHING WOULD BE CAUSE THE ISSUE IN THE CODE WHAT YOU THINK ABOUT PERSEINT? |
#8
|
|||
|
|||
Well, I created my own option called slideshow_width and set it to 610, then put the above code in my headinclude template. Then in the footer template I put this:
Code:
<script> document.writeln('Width ' + slideshow_width); </script> and it displays Code:
Width 610 Code:
window.alert("slideshow_width is " + slideshow_width"); and see what it says. Also, don't type in all caps, it looks like you're yelling. |
#9
|
|||
|
|||
to be honest I dont know the function that going to print this code
PHP Code:
if you can give me the function I would appreciate that ^^ I think something like copy this code to headinclude cache thank you |
#10
|
|||
|
|||
when I check the code through source
it appears like this <script type="text/javascript"> <!-- var lywomen_slideshow_width = parseInt("610", 10); var lywomen_slideshow_height = parseInt("439", 10); // --> </script> which is works 100% but the problem I think it's with the controduct in the js file which is this one I uploaded for you again |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|