473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

php script for webcomic navigation

hello, i am wondering if someone can help me code something relatively
simple for navigating through a linear series of php pages. my code is
halfway done, and is basically functional, but i would like to add
something to it. the code right now can find what page you are on, the
next page, and the previous page. here is how it currently reads:

<? //to get filename $p = $_SERVER["SCRIPT_NAME"]; $parts =
Explode('/', $p); $p = $parts[count($parts) - 1]; //get filename
$c = strtok($p,"."); //get number string

$nc = $c+1; //next comic $pc = $c-1; //previous comic

$ncf = "$nc.php"; $pcf = "$pc.php";

if (file_exists($ncf)) { echo "<a href=\"$ncf\">go to the next
page</a>"; } else { echo "<a href=\"0.php\">go to the first
page</a>"; } ?> <br /> <?

if (file_exists($pcf)) { echo "<a href=\"$pcf\">go to the
previous page</a>"; } else { echo "<a href=\"2.php\">go to
the latest page</a>"; } ?>

what i do if you are on the last page, a link to the first page would
show, and this is not a problem since 0.php can be hardcoded.

my problem, however, is in navigating the pages in decreasing order. is
there any way to look at the current directory and get the token of
only the php pages? i know that i can use the max() function to get the
greatest one listed, but i do not know how to list the files to use the
max() function. any help would be appreciated, and thank you in
advance.

-miguel

Jan 4 '06 #1
2 2121
Miguel,

Stop posting you idiot.
I see around 6 posting containing the same question.

That is great way to NO RESPONSE.

Erwin
miguel wrote:
hello, i am wondering if someone can help me code something relatively
simple for navigating through a linear series of php pages. my code is
halfway done, and is basically functional, but i would like to add
something to it. the code right now can find what page you are on, the
next page, and the previous page. here is how it currently reads:

<? //to get filename $p = $_SERVER["SCRIPT_NAME"]; $parts =
Explode('/', $p); $p = $parts[count($parts) - 1]; //get filename
$c = strtok($p,"."); //get number string

$nc = $c+1; //next comic $pc = $c-1; //previous comic

$ncf = "$nc.php"; $pcf = "$pc.php";

if (file_exists($ncf)) { echo "<a href=\"$ncf\">go to the next
page</a>"; } else { echo "<a href=\"0.php\">go to the first
page</a>"; } ?> <br /> <?

if (file_exists($pcf)) { echo "<a href=\"$pcf\">go to the
previous page</a>"; } else { echo "<a href=\"2.php\">go to
the latest page</a>"; } ?>

what i do if you are on the last page, a link to the first page would
show, and this is not a problem since 0.php can be hardcoded.

my problem, however, is in navigating the pages in decreasing order. is
there any way to look at the current directory and get the token of
only the php pages? i know that i can use the max() function to get the
greatest one listed, but i do not know how to list the files to use the
max() function. any help would be appreciated, and thank you in
advance.

-miguel


Jan 4 '06 #2
yes, sorry. my internet was messing up... i thought i got all the
double-posts...

Jan 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: infinull | last post by:
I am making a script that is a very complex Content Management system. it makes a UDM navigation bar and writes content and a title. i want it to write content other that just basic text, like a...
8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
13
by: Al Franz | last post by:
Anyone understand how to pass parameters to a JavaScript. If anyone finds this easy to do maybe they could take a look at my short script on this page and show me how it needs to be changed. ...
0
by: Salagir | last post by:
I crosspost and followup to comp.infosystems.www.authoring.stylesheets because we're not really on the webcomic topic any more :) On Thu, 19 Aug 2004 11:40:07 GMT, in rec.arts.comics.strips,...
1
by: P K | last post by:
Hi, I'd like to be able to use the arrow keys to trigger my navigation buttons. How do I specify that a right arrow key (->) is to activate the link of my right arrow button, and so forth? Thanks...
10
by: Chris Martin | last post by:
Background: Our main menu is built using a simple unordered list containing other ULs. There is a table on a page that holds the subnav. Because of certain circumstances, I need to build the subnav...
2
by: CoffeeGuy | last post by:
Hi, I'm hoping someone can point me in the right direction- I don't even know what keywords to search under for this one. I'm hoping it can be done with HTML as well, since that's all I've learned so...
0
by: zachwlewis | last post by:
I wrote and maintain the SomeryC Webcomic Management Script (http:// someryc.mostpopularcomic.com), and I was wondering if anyone would like to work on it as a coder for fun. SomeryC is written in...
0
by: evo27 | last post by:
hi guys. I'm trying to make a navigation menu with AS tweening. So far I have all 4 buttons and a graphic inside a movie clip named "logo_mc" with an instance name of "logo_mc". I have managed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.