473,395 Members | 1,631 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,395 software developers and data experts.

php webcomic navigation script

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
1 2942
The function you need is glob().

Jan 4 '06 #2

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

Similar topics

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,...
5
by: Ray | last post by:
Hi, I was wondering if anyone has any idea how this can be done. I am trying to show/hide navigation links based on server names or ip addresses. So if, someone visits a particular url/ip address...
2
by: Captain BirdsEye | last post by:
Hi, I've created html websites before and used javascript menus. I'm now currently creating an aspx website. Is there a way to write a simple navigation. e.g. mouseover a link and get a list...
2
by: Marc Castrechini | last post by:
With SmartNavigation=true a call to display a simple javascript alert returns in IE showing an "Invalid Pointer" error. Apparently when SmartNavigation is disabled then the alert works correctly....
28
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
10
by: EA | last post by:
I am sure I must be missing something about building navigation bars with CSS. Yes it is a very clever and efficient way to format navigation structures on simple one navigation level webs, i.e....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.