The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Random background image with PHP
I currently have a PHP function that does a directory scan and randomly pulls an image to appear in the background CSS tag...
It essentially creates the following entry before the BODY tag PHP Code:
Thanx |
#2
|
|||
|
|||
Try creating a new plugin using hook parse_templates and code like this (insert your function at the comment):
Code:
ob_start(); // call your function here $str = ob_get_contents(); ob_end_clean(); $vbulletin->templatecache['headinclude'] .= addcslashes($str, '\\"'); |
#3
|
|||
|
|||
hmm... I think I lost you... what value does $str need to be for it to work?
is this the value i am sending PHP Code:
|
#4
|
|||
|
|||
$str would have to be the entire thing you posted in the first post. If your function is only returning the part you posted above, then try this:
PHP Code:
Also, I was assuming that your function output a string. If it returns a string, then you don't need the ob_start()/ob_end_clean() calls. |
#5
|
|||
|
|||
ahh... so my plugin would look like this...
PHP Code:
|
#6
|
|||
|
|||
Looks good, except the post is missing the last } .
|
#7
|
|||
|
|||
Darn... the entry is getting inserted into the HTML when i view source... but the page isn't taking the value and showing the image... i even tried deleting the "background" value in style template of admincp... hmmmm.... so close
|
#8
|
|||
|
|||
What does it look like when you view the html? Looking more closely at the function you posted, I don't see where the "background-image: url(" and the closing ")" come from - maybe those need to be added to the plugin code?
|
#9
|
|||
|
|||
yup.. that was it.. i usually dont get much help in this forum....
THanks for the help! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|