Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 26 Jun 2012, 19:21
dsantana dsantana is offline
 
Join Date: Dec 2011
Random Image Forum Side Block?

I'm looking for code that will go to a designated directory "/images/ads/sideblock" and grab like 4 or 5 images and place them randomly there.

I found this code and tried to use it as php on a sideblock but I got an error.
I'm not a codr so I though I'd ask you guys that are...
Any help would be awesome...
Thanks...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #2  
Old 28 Jun 2012, 03:54
DivisionByZero's Avatar
DivisionByZero DivisionByZero is offline
 
Join Date: Dec 2002
Real name: Chris
first, are the files in this directory named in any specific order? (i.e.: img_1.jpg, img_2..)?
__________________
Professional vB development since 2002.
References & Praise: 1|2|3|4|5|6|7|8
Reply With Quote
  #3  
Old 28 Jun 2012, 07:22
setishock setishock is offline
 
Join Date: Feb 2008
http://www.alistapart.com/articles/randomizer/
The link to the code is near the bottom. Just copy and paste to notepad and save as rotate. php
Make a folder in your ftp and note the path to get to it. Drop your ads in there. Drop a copy of the rotate.php file in there with them.
From the block setup select html. Put the path to the rotate.php file in as the code and save.
Now every time you refresh the page from the browser or leave and come back to the page with the blocks, the rotate.php gets called. It selects a pic at random and displays it.
If you want to show different ads in different blocks you'll have to make more than one folder with your ads in them. Put the rotate.php in each folder and call for them from the different block setups. Otherwise if you call for the same rotate.php file from different blocks they all would show the same ad at the same time.
I would say go look at my site to see it in action but alas animeappeal is no more thanks to crappy hosting.
__________________
Working on new projects and expanding our horizons. Come by and see what we're up to now.
Reply With Quote
  #4  
Old 28 Jun 2012, 16:16
dsantana dsantana is offline
 
Join Date: Dec 2011
Originally Posted by DivisionByZero View Post
first, are the files in this directory named in any specific order? (i.e.: img_1.jpg, img_2..)?
No they're not

--------------- Added 28 Jun 2012 at 16:19 ---------------

Originally Posted by setishock View Post
http://www.alistapart.com/articles/randomizer/
The link to the code is near the bottom. Just copy and paste to notepad and save as rotate. php
Make a folder in your ftp and note the path to get to it. Drop your ads in there. Drop a copy of the rotate.php file in there with them.
From the block setup select html. Put the path to the rotate.php file in as the code and save.
Now every time you refresh the page from the browser or leave and come back to the page with the blocks, the rotate.php gets called. It selects a pic at random and displays it.
If you want to show different ads in different blocks you'll have to make more than one folder with your ads in them. Put the rotate.php in each folder and call for them from the different block setups. Otherwise if you call for the same rotate.php file from different blocks they all would show the same ad at the same time.
I would say go look at my site to see it in action but alas animeappeal is no more thanks to crappy hosting.
Will that allow multiple ads as pictured? One on top of the other?
Reply With Quote
  #5  
Old 28 Jun 2012, 21:56
setishock setishock is offline
 
Join Date: Feb 2008
I had 2 stacked in one block at one time. The block will expand vertically to hold what you cram in there. They all have to be the same width though.
I had the code stacked something like this:
url blah blah blah /br
url blah blah blah

Not real complicated.
__________________
Working on new projects and expanding our horizons. Come by and see what we're up to now.
Reply With Quote
  #6  
Old 28 Jun 2012, 23:00
dsantana dsantana is offline
 
Join Date: Dec 2011
Originally Posted by setishock View Post
I had 2 stacked in one block at one time. The block will expand vertically to hold what you cram in there. They all have to be the same width though.
I had the code stacked something like this:
url blah blah blah /br
url blah blah blah

Not real complicated.
If I have 10 images and want to have 5 at a time in there randomly and do it that way I could have duplicate images correct?
Reply With Quote
  #7  
Old 30 Jun 2012, 00:41
setishock setishock is offline
 
Join Date: Feb 2008
Say you have 100 ad pics. Make five folders and drop 20 pics in each along with the rotate.php file.
In the sidebar block setting choose html. Using the path to each one of the folders you get this:
url path to folder 1 rotate.php
url path to folder 2 rotate.php

And so on till you have 5 url's stacked. Click save. That should take care of it. You have to have separate url's to separate folders or you get dups.
__________________
Working on new projects and expanding our horizons. Come by and see what we're up to now.
Reply With Quote
  #8  
Old 03 Aug 2012, 18:22
pyes pyes is offline
 
Join Date: Mar 2012
great info guys....ty. works like a charm

Is there any way to hyper link the banners so people can click on them?
Reply With Quote
  #9  
Old 03 Aug 2012, 19:18
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
Originally Posted by setishock View Post
Say you have 100 ad pics. Make five folders and drop 20 pics in each along with the rotate.php file.
In the sidebar block setting choose html. Using the path to each one of the folders you get this:
url path to folder 1 rotate.php
url path to folder 2 rotate.php

And so on till you have 5 url's stacked. Click save. That should take care of it. You have to have separate url's to separate folders or you get dups.
Alternatively, he could remove the item from the array with unset() once it was used but this is probably easier if he isn't code savvy...
Reply With Quote
Reply



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


New To Site? Need Help?

All times are GMT. The time now is 20:49.

Layout Options | Width: Wide Color: