1
JMorris
Text over rotating image?
  • 2005/6/27 13:56

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


I'm working on the theme for work and what I want to do is use the built in Banners module to rotate a header graphic, then using a simple php script that reads a flat text file DB, display a random quote over top of the random graphic. Here's my code thus far:



); background-position:center; background-repeat:no-repeat;">
$quoteFile "quotes.txt";  //File holding qoutes
$fp fopen($quoteFile"r");   //Opens file for read
$content fread($fpfilesize($quoteFile));
$quotes explode("n",$content);   //Put quotes into array
fclose($fp);   //Close the file

srand((double)microtime()*1000000);  // randomize
$index = (rand(1sizeof($quotes)) - 1); //Pick random qoute

echo $quotes[$index]; //Print quote to screen
?>




The problem I'm running into is that php cannot be added to theme.html I've also tried inserting the custom code in the banner manager itself, like so:



http://127.0.0.1/xoops/images/banners/xoops_banner.gif); background-position:center; background-repeat:no-repeat;">
$quoteFile "quotes.txt";  //File holding qoutes
$fp fopen($quoteFile"r");   //Opens file for read
$content fread($fpfilesize($quoteFile));
$quotes explode("n",$content);   //Put quotes into array
fclose($fp);   //Close the file

srand((double)microtime()*1000000);  // randomize
$index = (rand(1sizeof($quotes)) - 1); //Pick random qoute

echo $quotes[$index]; //Print quote to screen
?>




Still no dice.

Does anyone know how to create a random image background with random text displayed over it?

Thanks for the help.
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

2
wcrwcr
Re: Text over rotating image?
  • 2005/6/27 16:46

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hi Jmorris

Did you see this theme?s random header function?
https://xoops.org/modules/news/article.php?storyid=2271&

At least to rotate the headers i guess it works

Btw> how dificult would be to call a quotes module on your header?

See you

3
simeon
Re: Text over rotating image?
  • 2005/6/27 17:46

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


i don´t know if i got it right.
but maybe try to put the code into a
inside the banners




<{php}>
$quoteFile "quotes.txt";
$fp fopen($quoteFile"r");   
$content fread($fpfilesize($quoteFile));
$quotes explode("n",$content);
fclose($fp);

srand((double)microtime()*1000000);  
$index = (rand(1sizeof($quotes)) - 1); 

$var $quotes[$index];
$GLOBALS['xoopsTpl']->assign'xoops_bantxt'$var);
<{/
php}>


<
td align="center" style="background-image:url(<{$xoops_banner}>); background-position:center; [color=990000]
(i dont think this centering is nessecary cause of the td is already centered)[/color]
background-repeat:no-repeat;"
>
<
div><{$xoops_bantxt}>div>td>



i didnt tryed it.see whats going on!

sime

4
JMorris
Re: Text over rotating image?
  • 2005/6/28 13:48

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Quote:
Btw> how dificult would be to call a quotes module on your header?


I tried using 3 different random quote modules in conjunction with the default banner manager and I could not get it to work.

Oh well, plan B. I'll just use a timed animated .gif applied through the CSS background-image property and use the default banner manager to rotate the quotes.

Thanks for the help.
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

Login

Who's Online

233 user(s) are online (149 user(s) are browsing Support Forums)


Members: 0


Guests: 233


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits