Log in

View Full Version : Help with an idea for dynamic content?



BLiZZaRD
12-14-2008, 03:17 PM
Hey all, this idea I had may be better served with JS, but I don't do JS so well so I am hoping I can do something in PHP, but I am stuck at the idea stage.

What I have is a side bar on every page of the site. each page I want to give the side bar a different ID number (or something similar). I then want the script to be placed in the sidebar code and when that page is viewed it will only pull certain images/php includes etc. from a directory.

So, for ease of use sake, let's say I have a directory with 50 images. And I have 5 pages on my site. I want each page to show a different 10 images, at random (random isn't a must have) but I don't want the 10 from page 1 to ever show on page 2, etc.

I am using "image" loosely here as I will also have text/links etc. (I am not explaining this well am I?)

So is there a way to give a div an ID number that corresponds to images (or pages) to display only matching IDs in the div?

If you are as confused as I make myself sound, ask for clarification.

Snookerman
12-14-2008, 03:36 PM
Assuming I understand you correctly, this could be done with jQuery (http://jquery.com/) which is much easier than JavaScript. You don't need to know much JavaScript to use jQuery and extract the id values. If you really want to do this with css (which I'm pretty sure would be more complicated than jQuery) then someone else might help you out.

BLiZZaRD
12-14-2008, 04:04 PM
Thanks. Looking for a simple array function methinks. on page load find /directory/ if ID == 2 display contents. Else display nothing.

Something like that. (more involved I know... just stating for ease of understanding.)

BLiZZaRD
12-17-2008, 06:41 PM
nothing else? If I can name the files something identifying? Say 1.php, 2.php, etc..?