Results 1 to 4 of 4

Thread: Help with an idea for dynamic content?

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default Help with an idea for dynamic content?

    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.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Assuming I understand you correctly, this could be done with jQuery 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.

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    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.)
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    nothing else? If I can name the files something identifying? Say 1.php, 2.php, etc..?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •