next, previous, and newest buttons

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
insert_witty_name_here
Forum Newbie
Posts: 4
Joined: Thu Feb 12, 2004 11:37 pm

next, previous, and newest buttons

Post by insert_witty_name_here »

:( ok, im lost. im making a web comic with some friends and i’ve figured out most of the php, but im having trouble with the buttons on the comic pages. i keep all of the pages with the comics in there own folder and they are always named like “1-descriptionblabla.html”, or “2-blabladescription.html”, and so on and so on, with number 1 being the first comic and the number going up one with every new comic page i make. now i want at the bottom of all of the pages there to be a button that goes to the next number down page called "back", one that goes to the next number up (unless its the newest comic) that is called "next", and one that goes to the current highest number called "newest comic".

i know this really is a lot to ask but i am really lost here and will appreciate any help anyone might be able to offer.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

the easiest, non-PHP way would jsut to be add links to the bottom of all the HTML pages. And the only one you would ever have to change would be the last one before your newest one. Change teh back to next and add a newest link. Seems easy enough, eh?
insert_witty_name_here
Forum Newbie
Posts: 4
Joined: Thu Feb 12, 2004 11:37 pm

RE:

Post by insert_witty_name_here »

yea i thought about just doing it in html, but every time i add a comic, then the "newest link" button on every page that it is on will have to be manually updated. with each comic its own page, which could quickly go into the hundreds of pages that i would have to change every time i added a comic.

what might make this a lot easier is if the names of the files were changed to the date they were posted (like 02/13/04.html). then the script would just look for the next date or the date before or the newest date
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

well make up your mind

do you want it to look for comic1.html comic2.htm comic3.html or it orders it automatically by date. I don't want to write some snipplets to get you started if thats not what you want
insert_witty_name_here
Forum Newbie
Posts: 4
Joined: Thu Feb 12, 2004 11:37 pm

re

Post by insert_witty_name_here »

oh, well the 1-comic.html, 2-comic.html... would be what i was really looking for. if that could work then that would be great.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

You could use the php filesystem fns to read directory contents, and then cretae appropriate links.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

insert_witty_name_here wrote:if that could work
what makes you think its not possible? Have you even tried? TO me that seems the most easiest and logical way. I mean, something so simple your not going to want to spend forever and a day working on a way to go to a different page...
spectre013
Forum Newbie
Posts: 5
Joined: Wed Jul 09, 2003 9:09 am
Location: Colorado, USA

Post by spectre013 »

I do some thing like this for our news paper. We name our file ni1.htm, ni2.htm for our news stories.

then we read the dir looking for files that start with ni count how many we have then loop through making the links like this.

Code: Select all

for($i=0; $i<$files; $i++)
&#123;
echo "<a href="ni:.$i.".htm">Title</a>";
&#125;
Hope that made makes sense, if you need more code just let me know will help you out.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

ya, thats a good idea! didn't think of that one, and i even use that same method for something some what similar! lol
Post Reply