• HEXUS
  • HEXUS.tv
  • channel
  • gaming
  • lifestyle
  • trust
  • community
  • ESReality
  • HEXUS.community discussion forumsVisit Corsair.com

    Welcome to the HEXUS.community discussion forums forums.

    You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development

    Software and web development Databases, graphics, programming, scripting and web development.

    Reply
     
    LinkBack Thread Tools
    Old 11-07-2005, 10:44 PM   #1 (permalink)
    Agent of the System
     
    ikonia's Avatar
     
    Join Date: May 2004
    Location: South West UK (Bath)
    Posts: 3,665
    Thanks: 35
    Thanked 62 Times in 45 Posts
    Simple Banner Script Javascript or PHP Advice

    Hello all.

    I'm looking at a possibility of putting together a small banner advertisment script thats VERY simple for a website I'm trying to put together (none proffit - and non comercial adds, hence why I ask)

    I have some basic PHP from a CMS that creates the following code
    <table width="100%" height="68" border="0" cellpadding="0" cellspacing="0">
    <tr>

    <td width="34%" height="65" align="left" valign="middle" id="align_left"><a href="http://www.test.co.uk"><img src="img/test_logo.gif" width="228" height="54" border="0"></a></td>
    <td width="66%" align="center" valign="middle"><a href="#"><img src="img/advert.gif" width="468" height="60" border="0"></a></td>
    </tr>
    </table>

    The part that interest me is


    <td width="66%" align="center" valign="middle"><a href="#"><img src="img/advert.gif" width="468" height="60" border="0"></a></td>
    What I'm thinking, is as follows something along the lines of

    <script language="javascript">
    <!-- some javascript that loops though a flat file or something and assigns a link url to $LINK and the matching image the $IMAGE variable
    --!>
    </script>
    <td width="66%" align="center" valign="middle"><a href="$URL"><img src="$IMAGE" width="468" height="60" border="0"></a></td>
    and then

    having a config file somthing linke

    ads.config


    www.testsite1.com images/test1.gif
    www.mysite.co.uk image/mysite.gif
    www.bigbob.net images/fatty.gif
    therefore the java script would loop through and assign www.testsite1.com to $LINK and images/test1.gif to $IMAGE

    the code would then look like this


    <script language="javascript">
    <!-- some javascript that loops though a flat file or something and assigns a link url to $LINK and the matching image the $IMAGE variable
    --!>
    </script>
    <td width="66%" align="center" valign="middle"><a href="$URL"><img src="$IMAGE" width="468" height="60" border="0"></a></td>
    and then

    having a config file somthing linke

    ads.config


    www.testsite1.com images/test1.gif
    www.mysite.co.uk image/mysite.gif
    www.bigbob.net images/fatty.gif
    therefore the java script would loop through and assign www.testsite1.com to $LINK and images/test1.gif to $IMAGE

    the code would then look like this


    <script language="javascript">
    <!-- some javascript that loops though a flat file or something and assigns a link url to $LINK and the matching image the $IMAGE variable
    --!>
    </script>
    <td width="66%" align="center" valign="middle"><a href="$URL"><img src="$IMAGE" width="468" height="60" border="0"></a></td>
    and then

    having a config file somthing linke

    ads.config


    www.testsite1.com images/test1.gif
    www.mysite.co.uk image/mysite.gif
    www.bigbob.net images/fatty.gif
    therefore the java script would loop through and assign www.testsite1.com to $LINK and images/test1.gif to $IMAGE

    the code would then look like this

    <script language="javascript">
    <!-- some javascript that loops though a flat file or something and assigns a link url to $LINK and the matching image the $IMAGE variable
    --!>
    </script>
    <td width="66%" align="center" valign="middle"><a href="www.testsite.com"><img src="images/test1.gif" width="468" height="60" border="0"></a></td>

    this is only the principal I'm trying to get my head around - and I'm only using javascript as an example

    I'd be happy to do something like include a php script that connects to a database and gets the data from a database table or flat file

    such as


    select image,url from adverts
    Does anyone have any experience with this, or could someone lend a hand.

    thanks.

    It is Inevitable.....

    ikonia is offline   Reply With Quote
    Old 12-07-2005, 01:57 PM   #2 (permalink)
    Large Member
     
    Join Date: Apr 2004
    Posts: 3,399
    Thanks: 27
    Thanked 28 Times in 23 Posts
    The easiest way I reckon is your database method. You want a script that generates a random number, and your db's advert table should include unique_key, image and url fields. The random number would be generated and your SQL statement would read SELECT * FROM adverts WHERE unique_key = '$random_number'. Of course your limitations here are assigning a max_value to to the random_number, you could increase it's value each time you add a new image/url to the database. The best solution however is to retrieve the metadata for the 'adverts' table which would return the no of rows, using this as your max_value. Of course this is all based on you wanting the the ad's random, and not in order, or not displaying the same ad twice etc. Good luck.

    To err is human. To really foul things up ... you need a computer.
    yamangman is offline   Reply With Quote
    Old 12-07-2005, 08:29 PM   #3 (permalink)
    Agent of the System
     
    ikonia's Avatar
     
    Join Date: May 2004
    Location: South West UK (Bath)
    Posts: 3,665
    Thanks: 35
    Thanked 62 Times in 45 Posts
    funny enough this is pretty much identical to the way I went.

    I'll post the code once its finished. I just needed to look at it from a different angle

    thanks for your view

    It is Inevitable.....

    ikonia is offline   Reply With Quote
    Reply

    Breadcrumb
    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Trackbacks are On
    Pingbacks are On
    Refbacks are On


    Similar Threads
    Thread Thread Starter Forum Replies Last Post
    PHP script errors after moving hosts.. Stoo Software and web development 15 15-07-2004 12:31 AM



    All times are GMT. The time now is 03:02 PM.

    Any representations/statements made on the HEXUS.community discussion forums are the representations/statements of the author i.e. the person/organisation making them. If any such representations/statements are disputed they are a matter between the parties concerned.
    HEXUS Limited accepts no responsibility for any misrepresentations, inaccurate or false statements made by any person/organisation other than HEXUS Limited employees.
    For more information please read HEXUS Limited's terms, conditions and privacy policy.

    Hosted Exchange | Virtual Dedicated Server

    Powered by vBulletin® Version 3.8.4
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
    Content Relevant URLs by vBSEO 3.3.2
    Copyright © 2010 HEXUS® Limited. All rights reserved. Unauthorised reproduction strictly prohibited.