Computers & Internet Logo

Related Topics:

Posted on Jul 06, 2009
Answered by a Fixya Expert

Trustworthy Expert Solutions

At Fixya.com, our trusted experts are meticulously vetted and possess extensive experience in their respective fields. Backed by a community of knowledgeable professionals, our platform ensures that the solutions provided are thoroughly researched and validated.

View Our Top Experts

What is the source code for page navigation in php

1 Answer

Anonymous

Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Governor:

An expert whose answer got voted for 20 times.

Hot-Shot:

An expert who has answered 20 questions.

  • Expert 86 Answers
  • Posted on Jul 07, 2009
Anonymous
Expert
Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Governor:

An expert whose answer got voted for 20 times.

Hot-Shot:

An expert who has answered 20 questions.

Joined: Jul 07, 2009
Answers
86
Questions
0
Helped
38482
Points
235

Check this code snippet
[PHP]
<?php
//If you use it, please link to my site
$full_path = getenv("REQUEST_URI");
//put the base URL in case you need it
$base = "http://subomain.domain.ext";
//Get the name of the file
$page_file = basename($full_path);
//The files are named file_1.php, file_2.php, etc. Extract number from it.
$page_num = substr($page_file
, strrpos($page_file, "_") + 1
, strpos($page_file, ".php") - strrpos($page_file, "_") - 1
);
$partial_path = substr($page_file, 0, strrpos($page_file, "_"));
//Build array of pagenumbers. Here are ten pages.
$all_pages = array (1,2,3,4,5,6,7,8,9,10);
foreach ($all_pages as $all_page)
{
//Create link to all the previus pages and put in prev-image.
if ($all_page < $page_num)
{
print "<a rel='nofollow' href="$partial_path"."_". $all_page . ".php"><img src="images/prev.gif" alt="$all_page" border="0"></a>";
}
//Create I-am-here-image.
elseif ($all_page == $page_num)
{
print "<img src="images/here.gif" alt="$page_num" border="0">";
}
//Create links to all the next pages and put in next-image.
else
{
print "<a rel='nofollow' href="$partial_path"."_" . $all_page . ".php"><img src="images/next.gif" alt="$all_page" border="0"></a>";
}
}
?>
[/PHP]

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

141 views

Ask a Question

Usually answered in minutes!

Top Adtran Computers & Internet Experts

ADMIN Andrew
ADMIN Andrew

Level 3 Expert

73781 Answers

ADMIN Eric
ADMIN Eric

Level 3 Expert

42220 Answers

Brad Brown

Level 3 Expert

19190 Answers

Are you an Adtran Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...