Jump to content

how could i do random main banners on my homepage?


Guest darthfury

Recommended Posts

Guest darthfury

Hello i develop and maintain www.coruscantcollectibles.com and im looking for a way for my banner on the mainpage to refresh to a diff. pic every time you refresh the page, is there some code for this and if so how would i go about applying it, im super new but a quick study.

or is there a way (like a mod) for cubecart that someone has written ?

Jim Sitzler

a.k.a. - Darth Fury

Link to comment
Share on other sites

I did it using a very simple code file on www.sensualelegance.com.

Where you want the image to appear - adjust width & height settings to match your images (such as in skins/yourskin/styletemplate/content/index.tpl):

<img src="../images/rotate/rotator.php" height="200" width="530" alt="alternate image text.">




and create a folder in images called "rotate" (or rename as desired), along with a new file (rotator.php in my example above), with the following code...




<?php

$files = glob('{*.jpg,*.gif}', GLOB_BRACE);

readfile($files[array_rand($files)]);

?>

basically this pulls any images in the same directory as the file in randomly.

Link to comment
Share on other sites

Guest kaskudoo

mh. That is simpler than I thought Misty .... and I was looking for sth. like that for a while (I guess I just wasn't looking hard enough!).

Will implement it after Christmas - Thanks and have a Merry Christmas :angry:

Link to comment
Share on other sites

Yup, it was easier than I thought it was going to be too :angry: I think I googled "random image php" or something and finally found a scripting site with an example :)

good luck and happy holidays to you too.

Link to comment
Share on other sites

  • 1 year later...

You can obviously add a fixed URL;

<a href="url"><img src...... /></a>

Howevever, I assume you want a different url per image.

This really needs something a bit more complex, either to read a text file for the image url and target url, or a database.

This mod really won't be a 3-liner, and its best to take this over to cubecartforums.org to discuss.

Jason

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...