Note that there are some explanatory texts on larger screens.

plurals
  1. POphp page navigation by serial number
    text
    copied!<p>Can anyone help in this php page navigation script switch on counting normal serial number? In this script there is a var called "page_id" - I want this var to store the real page link by order like 0, 1, 2, 3, 4, 5 ...</p> <pre><code>&lt;? $onpage = 10; // on page /* $pagerecord - display records per page $activepage - current page $records - total records $rad - display links near current page (2 left + 2 right + current page = total 5) */ function navigation($pagerecord, $activepage){ $records = 55; $rad = 4; if($records&lt;=$pagerecord) return; $imax = (int)($records/$pagerecord); if ($records%$pagerecord&gt;0)$imax=$imax+1; if($activepage == ''){ $for_start=$imax; $activepage = $imax-1; } $next = $activepage - 1; if ($next&lt;0){$next=0;} $end =0; $prev = $activepage + 1; if ($prev&gt;=$imax){$prev=$imax-1;} $start= $imax; if($activepage &gt;= 0){ $for_start = $activepage + $rad + 1; if($for_start&lt;$rad*2+1)$for_start = $rad*2+1; if($for_start&gt;=$imax){ $for_start=$imax; } } if($activepage &lt; $imax-1){ $str .= ' &lt;a href="?page='.($start-1).'"&gt;&lt;&lt;&lt; End&lt;/a&gt; &lt;span style="color:#CCCCCC"&gt;•&lt;/span&gt; &lt;a href="?page='.$prev.'"&gt;&lt; Forward&lt;/a&gt; | '; } $meter = $rad*2+1; //$rad; --------------------- for($i=$for_start-1; $i&gt;-1; $i--){ $meter--; //$line = '|'; if ($meter=='0'){ $line = ''; } $line = ''; if ($i&gt;0)$line = '|'; if($i&lt;&gt;$activepage){ $str .= " &lt;a href='?page=".$i."&amp;page_id=xxx'&gt;".($i)."&lt;/a&gt; ".$line." "; } else { $str .= " &lt;strong&gt;[".($i)."]&lt;/strong&gt; ".$line." "; } if($meter=='0'){ break; } } if($activepage &gt; 0){ $str .= " | &lt;a href='?page=".$next."'&gt;Back &gt;&lt;/a&gt; &lt;span style='color:#CCCCCC'&gt;•&lt;/span&gt; &lt;a href='?page=".($end)."'&gt;Start &gt;&gt;&gt;&lt;/a&gt; "; } return $str; } if(is_numeric($_GET["page"])) $page = $_GET["page"]; $navigation = navigation($onpage, $page); // detect navigation echo $navigation; ?&gt; </code></pre> <p>Instead xxx here (page_id=xxx) I want to link to real page number by normal order when this script show links but reversed.</p> <p>Really need help with this stuff! Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload