Page 1 of 1

Best way to include banner

Posted: Sun Aug 27, 2006 4:10 pm
by Miha
Hi,

what's the best way, to include banner into a page, so that the page administrator can change/upload new banner without changing page's sourcecode. I'm using php technology with MySQL on this page. I also built administrator section for adding news, maybe i should add something for a banner? Banners will be in .swf and .gif format.
Any suggestions how to do this??

regards, Miha.

Posted: Sun Aug 27, 2006 4:11 pm
by Benjamin
Might want to save time and see if you can find a decent banner manager on hotscripts.com

Posted: Sun Aug 27, 2006 4:16 pm
by jabbaonthedais
You could include a banner.php page that just had the banner image name and url. If you wanted it to swap out, you could write a script to randomly show a different banner each time.

Posted: Sun Aug 27, 2006 10:13 pm
by RobertGonzalez
I store my banner code in my datanbase and then show a different one based on a rand() order from the database on each page load. I also use this technique for changing heading text on certain parts of my site.

Code: Select all

SELECT `banner_url`, `banner_img`, `banner_alt` FROM `banners` ORDER BY RAND() LIMIT 0, 1;

Posted: Sun Aug 27, 2006 11:10 pm
by Benjamin
MySQL's rand function is garbage.

Posted: Sun Aug 27, 2006 11:35 pm
by RobertGonzalez
For little things like this, it as served its purpose for me.

Posted: Sun Sep 03, 2006 3:02 am
by Miha
I solved my problem. I made an admin page, where administrator can upload a file(.swf or .gif) and link. File is uploaded into some directory on server, filename and link is stored into MySQL. To include a banner on a page i wrote a simple function. It just gets filename and link from database(the last one), finds out whitch type of file it is, and depending on that, it echos out <a href='link'....<img.....'filename'... or swf object with 'filename'...