Show 1 div with PREV - NEXT link, hiding all others, Show 1 div with PREV - NEXT link, hiding all others |
Show 1 div with PREV - NEXT link, hiding all others, Show 1 div with PREV - NEXT link, hiding all others |
Baffled in Baltimore |
Jan 9 2009, 05:29 PM
Post
#1
|
Member Group: Members Posts: 51 Joined: 9-January 09 From: Baltimore, MD Member No.: 7,507 |
First, thank you for your patience and please forgive the lengthy blurb. This is a bit complicated, but I am sure there is a fix.
My website is heavily CSS structured for layout and styles for its Side-bar, heading, menu, etc. A modified CSS is used for the content and the content section is now an Iframe where all content is targeted. This was done to prevent duplication of parent. I am using GOOGLE site-map generator for the web and FreeFind for my site. Site consists of hundreds of HTML each consisting of an Image linked to a bigger image, Content, PayPal Links and other content all created with Excel for the code, Nvu for the file-saves and HTMLToolkit for the previews and error checking. When someone clicks an image anywhere on the site, it opens the HTML associated with it giving all the information about the Image. By the way, they are all table-based pages; DUMB, I know. The Problem: All these pages require updates or deletions depending on stock and pricing for any given item and frequent crawler checks for broken links afterwards. My site Spiders at roughly 500 pages and it keeps growing and getting out of hand. HELLLLLP!!!! On a more personal note; the author of the website (that’s me) is loosing his vision and can no-longer keep-up with this maddening effort… Proposed solution: I believe that enclosing all images and their associated content in DIVS is the better way to go. The idea is to have all images along with its content on one HTML. There are different categories that would use their own pages but the goal is to remove those hundreds of HTML pages and replace them with maybe a couple of dozen Category pages instead. There are as few as 1 or 2 items to as many as 100 items for any given category that would be shown 1-at-a-time using PREV - NEXT links. What I would like to accomplish is;
Whew!!! I told you it was complicated. Any assistance on setting this up (show 1 and hide the rest) is greatly appreciated. CHEERS This post has been edited by Baffled in Baltimore: Jan 9 2009, 05:56 PM |
Baffled in Baltimore |
Jan 11 2009, 09:26 AM
Post
#2
|
Member Group: Members Posts: 51 Joined: 9-January 09 From: Baltimore, MD Member No.: 7,507 |
Hello again;
Based on the sample code (php script), how would an external file for the divider sections be named to make the script work? Thanks again for your help. This post has been edited by Baffled in Baltimore: Jan 11 2009, 09:50 AM |
Christian J |
Jan 11 2009, 10:43 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,659 Joined: 10-August 06 Member No.: 7 |
With an external file you'll need a different script. Note that this could be buggy, it's just to show the concept:
CODE <body> <?php // content of the remote HTML page: $content=file_get_contents('content.html'); // divide HTML page content into sections, separated by the string "#separator#": $section=explode('#separator#', $content); // last item of two or more: if(isset($_GET['section']) && count($section)>3 && $_GET['section']=='100'.count($section)-2) { echo $section[(count($section)-2)].' <p> <a href="?section=100'.(count($section)-3).'">Previous</a> Next </p> '; } // items between the first and last: else if(isset($_GET['section']) && $_GET['section']>1001 && $_GET['section']<'100'.count($section)-2) { for($i=2; $i<(count($section)-2); $i++) { if($_GET['section']=='100'.$i) { echo $section[$i].' <p> <a href="?section=100'.($i-1).'">Previous</a> <a href="?section=100'.($i+1).'">Next</a> </p> '; } } } // first item of two or more: else if(count($section)>3) { echo $section[1].' <p> Previous <a href="?section=1002">Next</a> </p> '; } // single item: else { echo $section[1].' <p> Previous Next </p> '; } ?> </body> The external page called "content.html": CODE <body> Put no content here (before the first separator). If this line of text shows up something went wrong. #separator# <h1>1001</h1> <p>Lorem ipsum</p> #separator# <h1>1002</h1> <p>Lorem ipsum</p> #separator# <h1>1003</h1> <p>Lorem ipsum</p> #separator# <h1>1004</h1> <p>Lorem ipsum</p> #separator# Put no content here (after the last separator). If this line of text shows up something went wrong. </body> |
Baffled in Baltimore |
Feb 25 2009, 11:16 AM
Post
#4
|
Member Group: Members Posts: 51 Joined: 9-January 09 From: Baltimore, MD Member No.: 7,507 |
Hello Christian, J
Thank you again for all your great help, I learned a great deal from you. Regarding PHP Since I now have server-side scripting capability, (YEAHHHH!!!) I was wondering if you could help with this; auto1.php The php currently loads into an iframe from one of my pages and it in turn loads in an external file called "test.html". How do I add a thumbs section to the php script if the external html that contains it has a DIV ID'd as "gallery"? The PHP you provided CODE <?php // content of the remote HTML page: $content=file_get_contents('test.html'); // divide HTML page content into sections, separated by the string "#separator#": $section=explode('#separator#', $content); // last item of two or more: if(isset($_GET['section']) && count($section)>3 && $_GET['section']=='100'.count($section)-2) { echo $section[(count($section)-2)].' <p> <a href="?section=100'.(count($section)-3).'">Previous</a> Next </p> '; } // items between the first and last: else if(isset($_GET['section']) && $_GET['section']>1001 && $_GET['section']<'100'.count($section)-2) { for($i=2; $i<(count($section)-2); $i++) { if($_GET['section']=='100'.$i) { echo $section[$i].' <p> <a href="?section=100'.($i-1).'">Previous</a> <a href="?section=100'.($i+1).'">Next</a> </p> '; } } } // first item of two or more: else if(count($section)>3) { echo $section[1].' <p> Previous <a href="?section=1002">Next</a> </p> '; } // single item: else { echo $section[1].' <p> Previous Next </p> '; } ?> Thanks again |
Baffled in Baltimore |
Feb 25 2009, 10:17 PM
Post
#5
|
Member Group: Members Posts: 51 Joined: 9-January 09 From: Baltimore, MD Member No.: 7,507 |
Regarding PHP Addendum What I would like to do is add an Image gallery to the beginning of the file. When the script calls the page, it starts with the image gallery. Then an image is selected, loading the appropriate details for that image. A gallery link needs to be added to the script allowing the user to go back to the gallery for another selection. Thanks again. |
Lo-Fi Version | Time is now: 26th April 2024 - 06:13 PM |