Current location: Hot Scripts Forums » Programming Languages » PHP » extracting info about a url & then manipulate it?


extracting info about a url & then manipulate it?

Reply
  #1 (permalink)  
Old 07-20-05, 10:42 PM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Question extracting info about a url & then manipulate it?

Hi,

My pages are all named image1.php, image2.php, image3.php, image50.php, etc...

I need to find out what page I'm currently on and then get the name of the next page which will be current page plus one.

Here is what I have so far:

PHP Code:

$path_parts pathinfo("$PHP_SELF");

echo 
$path_parts['basename'], "\n"
If my current page is image5.php, that will give me image5.php.

How do I assign $next = "image6.php"?

Hope that makes sense.

Thanks,

Tim
Reply With Quote
  #2 (permalink)  
Old 07-21-05, 02:03 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

$fileName = basename($path_parts['basename'], '.php');
$index = substr($fileName, 5);
$index++;

echo 'image' . $index . '.php';
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more

Last edited by dennispopel; 07-21-05 at 02:06 AM.
Reply With Quote
  #3 (permalink)  
Old 07-21-05, 11:09 AM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

Thanks for your response! Here's the code I ended up using:

PHP Code:

$path_parts pathinfo("$PHP_SELF");

$fileName $path_parts['basename'];
$index substr($fileName5, -3);
$index++;
$nxone 'image' $index '.php'
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Reasons Why do you Need URL Rewriting MODULE to Enchance your Web? handry PHP 11 08-05-05 07:32 AM
Passing info between pages w/ URL HairySpider JavaScript 6 01-09-05 08:47 AM
iframe linking not working under url masking willNoClue HTML/XHTML/XML 1 08-02-04 10:34 AM
cascade info script? zeon Script Requests 0 05-23-04 11:42 PM
reading info from a file (csv / xls) and displaying info lordmerlin PHP 7 03-20-04 03:39 PM


All times are GMT -5. The time now is 06:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.