470,833 Members | 1,195 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

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 1970
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Johnny Knoxville | last post: by
13 posts views Thread by Al Franz | last post: by
reply views Thread by Salagir | last post: by
1 post views Thread by P K | last post: by
10 posts views Thread by Chris Martin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.