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.
Best way to include banner
Moderator: General Moderators
-
jabbaonthedais
- Forum Contributor
- Posts: 127
- Joined: Wed Aug 18, 2004 12:08 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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;- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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'...