Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Randomized content - how is it done in a webpage?

  • 08-11-2006 11:43am
    #1
    Registered Users, Registered Users 2 Posts: 1,795 ✭✭✭


    I would like to know, if any of guys do, how to add randomized content to any page. For example, banner ads - how do I get a set number of random ones shown on a web page each time it is refreshed/visited?

    Seanie.


Comments

  • Moderators, Politics Moderators Posts: 41,240 Mod ✭✭✭✭Seth Brundle


    It can be done using server or client side code. I tend to use server side code as I can track theh number of advert loads etc.
    Has your hosting a/c the ability to run server side code?
    JavaScript random() method...


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    javascript,perl, php,asp,asp.net ... pick your poison


  • Registered Users, Registered Users 2 Posts: 1,795 ✭✭✭Seanie M


    kbannon wrote:
    It can be done using server or client side code. I tend to use server side code as I can track theh number of advert loads etc.
    Has your hosting a/c the ability to run server side code?
    JavaScript random() method...

    I am assuming it does. I have a Deluxe package with GoDaddy. I personally don't care about the amount of clicks the ad banners will have, as they will be sold on time spent online, so I guess that makes the client side code the option? But, where can I research the code some more?

    S.


  • Moderators, Politics Moderators Posts: 41,240 Mod ✭✭✭✭Seth Brundle


    Maybe your best bet is to find out your database/language options and go for a pre built banner advert manager.
    Is godaddy your host or domain registrar (or both)?


  • Registered Users, Registered Users 2 Posts: 1,795 ✭✭✭Seanie M


    Tis both.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,170 ✭✭✭Serbian


    Server side is the way to go with this. ASP.NET has a banner rotation control built in, while PHP has many free scripts available for doing this kind of thing (e.g. phpAdsNew).


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Function to get banner:
    [php]
    function getBanner (){
    $array = file("/site/includes/banners.php");
    $random_key=array_rand($array);
    return $item=$array[$random_key];
    }
    [/php]

    banners.php:
    [php]
    <a href="http://last.fm"><img src="http://www.redbrick.dcu.ie/~cult/_images/banners/socialmusicrevolution.gif&quot; title="Last.fm - Social Music Revolution" alt="Last.fm" width="460px" height="60px" border="0"/></a>
    <a href="http://last.fm"><img src="http://www.redbrick.dcu.ie/~cult/_images/banners/socialmusicrevolution2.gif&quot; title="Last.fm - Social Music Revolution" alt="Last.fm" width="460px" height="60px" border="0"/></a>
    <a href="http://last.fm"><img src="http://www.redbrick.dcu.ie/~cult/_images/banners/socialmusicrevolution3.gif&quot; title="Last.fm - Social Music Revolution" alt="Last.fm" width="460px" height="60px" border="0"/></a>
    [/php]

    Well, that's what I use. There's plenty of different ways to do it.


  • Registered Users, Registered Users 2 Posts: 1,795 ✭✭✭Seanie M


    Serbian wrote:
    Server side is the way to go with this. ASP.NET has a banner rotation control built in, while PHP has many free scripts available for doing this kind of thing (e.g. phpAdsNew).

    That link does not quite make the cut as far as I can find.

    I am finding lots of scripts out tere for what I want, but they all pertain to a single random image. I need one for multiple images. And, upon refresh/page load - not timed rotation.

    S.


  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    I found a great wee php script for a random image on page reload a while ago. If nobody posts it I'll stick it up later. This one takes a random image from a specified folder.

    Try searching Google though for now, the answer is out there - I found it so anyone can.


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    You can all go die. Mine does exactly that.

    And includes links.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    :D

    Sorry CuLT, I can't site-read PHP so I have no idea what your code does!


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Seanie M wrote:
    That link does not quite make the cut as far as I can find.

    You obviously haven't actually tried using it.
    Seanie M wrote:
    I am finding lots of scripts out tere for what I want, but they all pertain to a single random image. I need one for multiple images. And, upon refresh/page load - not timed rotation.

    S.

    PhpAdsNew will quite happily rotate multiple content sections per page based on parameters that you define, though the basic setup is page refresh / load


  • Registered Users, Registered Users 2 Posts: 4,479 ✭✭✭wheres me jumpa


    blacknight wrote:
    You obviously haven't actually tried using it.



    PhpAdsNew will quite happily rotate multiple content sections per page based on parameters that you define, though the basic setup is page refresh / load

    Second that. Ive been running PhpAdsNew for three months now and its really simple to use, however I feel im not using a quarter of its features so it may be too much for the OP.


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Second that. Ive been running PhpAdsNew for three months now and its really simple to use, however I feel im not using a quarter of its features so it may be too much for the OP.
    I know the feeling :)

    I've been using it on and off for years and still only use a fraction of it. One of our clients recently started using it to serve several million banners a month to their affiliates and are delighted with it


  • Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    i use php and just use the rand(1,n); piece of code to pick what banner to display as its a fixed monthly price for any add!


Advertisement