WordPress.org

Ready to get started?Download WordPress

Forums

Rotating banner in index.php (11 posts)

  1. TonyWright
    Member
    Posted 7 years ago #

    Hi there. I currently run a rotating banner script on my forums called 'ultimate banner'.

    It's a simple operation, whereby the .js points to a directory of images and gives instructions for these to be rotated. The forum's header contains:

    <script language="JavaScript" SRC="ultimateBanner.js"></SCRIPT>

    which activates and displays the rotating banners.

    I've been trying to add exactly the same thing to my front page, http://www.rapnews.co.uk

    I've added a unique ultimatebanner.js in my default theme's main directory, and told it to display what images I want et. I've been added the script I use in the forum header, to where I'd like it on the index.php.

    I've had little joy with this. The main page loads slowly and when it's completed, there's no image and the status bar reads 'error in page'.

    I can't think what I'm doing wrong. The official instructions of the script say to insert:

    <BODY onLoad="displayBanners()">
    <A HREF="javascript:goTo()" onMouseOver="show(); return true" onMouseOut="window.status=''; return true"><IMG SRC="default.jpg" ALT="Banner" NAME="img" BORDER="1" WIDTH="400" HEIGHT="50"></A>

    into the body of the page you want the script on. For whatever reason years go, I didn't use this for the forums. However, I've tried this on the main page and it too poses errors. It merely displays an unloaded image called 'default.jpg'. This isn't referenced in the .js nor does it exist.

    For the time being, I've deleted all script and desired images for the main page, and merely have a static, non rotating image up.

    Any help would be highly appreciated. Thanks, Tony.

  2. DesignPastor
    Member
    Posted 7 years ago #

    have you looked into an alternate option? like "Randomize" -

    Versatile randomizer plugin - just gets/stores random stuff for inclusion/printing somwhere on any page. This could be random quotes, random references to images, random links, etc… - split it in as many categories as you like.

    http://andersdrengen.dk/projects

    I have used this on several sites I have modified or published to the web ... works GREAT !! and EZ to manage

  3. TonyWright
    Member
    Posted 7 years ago #

    Thanks, are there any other alternatives?

    I successfully added the plugin but when entering its call up in the index.php code, it displayed the url of my desired banner, rather than the image itself.

    Also, it didn't look like there was a simply way to make each banner link to an external url which is essential for a rotating advert banner system.

    Many thanks. Tony.

  4. TonyWright
    Member
    Posted 7 years ago #

    Anyone?

  5. earleyedition
    Member
    Posted 7 years ago #

    I use 'rotator', Tony.

    From memory it was really simple to set up.

    Couldn't remember where I got it, but while searching came across this.

    Hope that's some use to you. I'm no guru.

  6. DesignPastor
    Member
    Posted 7 years ago #

    tony, are you referring to the plugin "randomize" when you say it is calling up the url and not the image itself?

    there is a trick to it ... you have to input the banner just as you would in HTML format ...

    i can give you a reference code to look at ... but treat it just like HTML .. with <IMG SRC= ..../> and <A HREF=".../>

    once you do that .. it will appear with proper linkage ..

  7. TonyWright
    Member
    Posted 7 years ago #

    and it'll still rotate? ill try it out. thanks.

  8. Ugh, why does everyone insist on doing things the hard way? Name your banners numerically (1, 2, 3, etc.) and then just use some simple PHP:

    <img src="<?php echo get_bloginfo('template_url') . '/images/headers/' . mt_rand(1, 10) . '.jpg'; ?>" alt="My Header" />

    Just change that "10" to the number of images you have.

  9. TonyWright
    Member
    Posted 7 years ago #

    It seems that there are no scripts or plugins which will enable me to run a variety of random bannners, which all have a unique url assigned to them, therefore meaning I can't have more than one image/advertiser on my site...

  10. estjohn
    Member
    Posted 7 years ago #

    php itself can be set up to pull a single image and associated url from a directory you specify and have it change randomly each time the page is reloaded.

  11. TonyWright
    Member
    Posted 7 years ago #

    how can it be set up this way?

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic