![]() |
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 |
Try creating a new plugin using hook parse_templates and code like this (insert your function at the comment):
Code:
ob_start(); |
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:
|
$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. |
ahh... so my plugin would look like this...
PHP Code:
|
Looks good, except the post is missing the last } .
|
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
|
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?
|
yup.. that was it.. i usually dont get much help in this forum....
THanks for the help! Quote:
|
All times are GMT. The time now is 02:58 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|