rusbb Posted June 8, 2007 Share Posted June 8, 2007 Hi i have a navigation script in my php coded page and it isnt working properly for some weird reason (Only an unusable << Previous text appears on my page, ie. No Next >> at all) The code is /***************************** * NAVIGATION * *****************************/ function navigation ($cat) { global $page, $total, $pro_id, $chpu, $path; $pervpage = ''; $nextpage = ''; if ($chpu == 1) { $cat = (!empty($cat)) ? $cat = 'cat_'.$cat.'/' : ''; } else { $cat = (!empty($cat)) ? $cat = 'cat='.$cat.'&' : ''; } // Checking whether back arrows are requires if ($page != 1) { // modrewrite support if ($chpu == 1) { $pervpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page - 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } else { $pervpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page - 1)." style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } if ($page == $total || $total == 0) { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } // Checking whether forward arrows are requires } elseif ($page != $total && $total != 0) { // modrewrite support if ($chpu == 1) { $nextpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page + 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } else { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } if ($page == 1) { $nextpage = '<span> << Previous </span>'; } } // Menu display $nav_menu = '<div class="link_nav">' .$pervpage. ' ' .$nextpage. '</div>'; // If no ID then display navigation menu if(empty($pro_id)) return $nav_menu; } ?> thanks for your help in advance Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/ Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 bump! Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270549 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 okay i found one mistake which was $nextpage rather than $pervpage was used so now the Next >> page comes up and goes to page 2 but that is where i mysteriously dissapears (<< Previous works and takes back to page 1) so basically i can navigate from page 1 to 2 but not any further (i have 3 pages though) the new code is // Checking whether back arrows are requires if ($page != 1) { // modrewrite support if ($chpu == 1) { $pervpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page - 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } else { $pervpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page - 1)." style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } if ($page == $total || $total == 0) { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } // Checking whether forward arrows are requires } elseif ($page != $total && $total != 0) { // modrewrite support if ($chpu == 1) { $nextpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page + 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } else { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } if ($page == 1) { $pervpage = '<span> << Previous </span>'; } } Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270553 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 okay i have tried manually accessing page 3 and there is a Next >> (grayed out) and a working << Previous. then i accessed manually page 4 and again Next >> was gone however a working << Previous was there. This problem seems to appear on even numbered pages only. Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270558 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 i am not able to understand the code, what is $chpu ?... what times it will turn 1 ? logic is not clear, i think you need to paste the entire code.... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270566 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 nevermind $chpu (it checks whether modrewrite is on i.e. $chpu = 1 when modrewrite option is on) what i find weird is that it doesnt work on even numbered pages yet works perfectly fine on odd pages here is more code from an associated file: <?php /** * My module (portfolio.php) * */ // vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4: // style coding K&R if(!defined('DATALIFEENGINE')) { die("This file cannot be acessed directly!"); } // required files require_once(ENGINE_DIR.'/data/config.pf.php'); require_once(ENGINE_DIR.'/modules/portfolio.func.php'); /******************************************** * Main variables * ********************************************/ // locale $table_bd1 = PREFIX."_proekts_cat"; $table_bd2 = PREFIX."_proekts"; // cache file $file_cache = "portfolio_cat"; // path to images $path = $config['http_home_url']; // content variable $content = ''; // cell variable $add_cell = ''; // cell variable 2 $add_cell_pro =''; // category menu variable $cat_menu = ''; // module info variable $modul_info = ''; // link variable $link = ''; // modrewrite variable $chpu = $config_pf['chpu']; // get current page $page = intval(@$_GET['page']); // get category numbers $row_cat = get_cache_cat($file_cache, $table_bd1); $get_count_cat = count($row_cat); // get project numbers $row_pro = $db -> super_query("SELECT id FROM {$table_bd2}", TRUE); $get_count_pro = (gettype($row_pro) == "array") ? count($row_pro) : 0; /***************************** * Category display * *****************************/ // if there is at least one category show it if ($get_count_cat > 0) { $cat_menu .= '<table width="100%" height="100%" class="cat_navigation_new"><tr>'; // number of category rows $c_tr = 0; // show category list for ($i = 0; $i < $get_count_cat; $i++) { // Sort into 9 columns if (($i % 9 == && ($i != 0)) { $tr1 = ''; $tr2 = '</tr><tr>'; $c_tr++; } else { $tr1 = ''; $tr2 = ''; } // modrewrite support if($chpu == 1) { $linkc = "<a href=\"{$path}portfolio/cat_{$row_cat[$i]['catnamelat']}\">"; } else { $linkc = "<a href=\"{$path}index.php?do=portfolio&cat={$row_cat[$i]['catnamelat']}\">"; } $cat_menu .= $tr1. '<td style="padding:3px; padding-left: 10px; border: 1px solid #F0F0F0;"> <img src="{THEME}/images/pf/pointer.gif" width="15" height="15" /> '.$linkc . $row_cat[$i]['catname'].'</a></td>'.$tr2; } // add blank cells if neede if ($get_count_cat % 3 == 0) { $add_cell = ''; } else { for ($k = 0; $k < ((3 * ($c_tr + 1)) - $get_count_cat); $k++) $add_cell .= '<td style="padding:3px; padding-left: 10px; border: 1px solid #F0F0F0"> </td>'; } $cat_menu .= $add_cell.'</tr></table>'; // if no categories available display this message } else { $cat_menu = '<div id="fh3"> - There are currently no categories - </div>'; } // Information block $modul_info .=<<<HTML <table width="100%" height="100%"> <tr> <td class="pf_info" style="padding-left:20px; border-bottom:1px solid #F0F0F0;"> <b>Statistics </b></td></tr> <tr> <td class="pf_info"> <img src="{THEME}/images/pf/pointer1.gif" width="13" height="9" /> Categories: {$get_count_cat} </td></tr> <tr> <td class="pf_info"> <img src="{THEME}/images/pf/pointer1.gif" width="13" height="9" /> Titles: {$get_count_pro} </td></tr> </table> HTML; ////////////////////////////////////////////////////// // If no category chosen, show latest titles if (($_SERVER['QUERY_STRING'] == 'do=portfolio') || !empty($_REQUEST['page'])) { // checking number of titles $get_query_pro = "SELECT * FROM {$table_bd1}, {$table_bd2} WHERE {$table_bd1}.`id` = {$table_bd2}.`pcat` ORDER BY {$table_bd2}.`pname` ASC"; $row_pro = $db -> super_query($get_query_pro, TRUE); $get_count_pro = (gettype($row_pro) == "array") ? count($row_pro) : 0; $not_pro = 1; ////////////////////////////////////////////////////// // If category chosen, show category titles } elseif (!empty($_REQUEST['cat']) && empty($_REQUEST['id'])) { // checking category $catlat = strip_cat ($_REQUEST['cat']); // show quotes if no category chosen if(!get_magic_quotes_gpc()) { $catlat = mysql_escape_string($catlat); } // checking number of titles $get_query_pro = "SELECT * FROM {$table_bd1}, {$table_bd2} WHERE {$table_bd1}.`id` = {$table_bd2}.`pcat` AND {$table_bd1}.`catnamelat` = \"$catlat\" ORDER BY {$table_bd2}.`pname` ASC"; $row_pro = $db -> super_query($get_query_pro, TRUE); $get_count_pro = (gettype($row_pro) == "array") ? count($row_pro) : 0; ////////////////////////////////////////////////////// // Åif category and title chosen show the title } elseif (!empty($_REQUEST['cat']) && !empty($_REQUEST['id'])) { // checkign category $catlat = strip_cat ($_REQUEST['cat']); // checking title $pro_id = strip_cat ($_REQUEST['id']); // showing quotes if no category or title chosen if(!get_magic_quotes_gpc()) { $catlat = mysql_escape_string($catlat); $pro_id = mysql_escape_string($pro_id); } // checking number of titles $get_query_pro = "SELECT * FROM {$table_bd1}, {$table_bd2} WHERE {$table_bd1}.`id` = {$table_bd2}.`pcat` AND {$table_bd1}.`catnamelat` = \"$catlat\" AND {$table_bd2}.`id` = \"$pro_id\" ORDER BY {$table_bd2}.`pname` ASC"; $row_pro = $db -> super_query($get_query_pro, TRUE); $get_count_pro = (gettype($row_pro) == "array") ? count($row_pro) : 0; } ////////////////////////////////////////////////////// // Page navigation // How many titles on main page if(!empty($config_pf['pro_on_main']) && ($config_pf['pro_on_main'] <= $get_count_pro)) { $pro_on_main = $config_pf['pro_on_main']; } elseif (empty($config_pf['pro_on_main'])) { $pro_on_main = 6; } else { $pro_on_main = $get_count_pro; } // choose which number to start showing titles from $start = $page * $pro_on_main - $pro_on_main; $total = @ceil(($get_count_pro / $pro_on_main)); // check what was received from db if ($page <= 0 || $total == 0 || $get_count_pro == 0 || $start > $get_count_pro) { $page = 1; $start = 0; } // extra navigation parameters if(($pro_on_main * $total >= $get_count_pro) && ($page == $total)) { $add = $pro_on_main - ($pro_on_main * $total - $get_count_pro); } else { $add = $pro_on_main; } /*************************************** * Title display * ***************************************/ $dlinksFile = file('uploads/texts/' . $row_pro[0]['pname'] . '.txt'); if (is_array($dlinksFile)) { $links = ""; foreach ($dlinksFile as $line) { list($name, $link) = split(" http://", $line); $links .= '<a href="http://' . $link . '">' . $name . '</a><br>'; } $dlinks .= $links; } else { $dlinks .= '<br/><b>Sorry - the links are not ready (or have been removed), come back another time</b>'; } // If at least one title exists show it // Number of title rows $c_tr_pro = 0; if ($get_count_pro > 0) { // if id chosen, take to that project if (!empty($pro_id)) { // create category menu $menu_cat = trans($row_cat, $row_pro[0]['pcat']); // get methods $mass_tools = explode('|', $row_pro[0]['checktools']); $tplt = @file_get_contents(ROOT_DIR.'/templates/'.$config['skin'].'/portfolio.tpl'); $check1 = (!empty($mass_tools[0])) ? 'on' : 'off'; $tplt = str_replace("{check1}", $check1, $tplt); $check2 = (!empty($mass_tools[1])) ? 'on' : 'off'; $tplt = str_replace("{check2}", $check2, $tplt); $check3 = (!empty($mass_tools[2])) ? 'on' : 'off'; $tplt = str_replace("{check3}", $check3, $tplt); $tplt = str_replace("{proekt_name}", $row_pro[0]['pname'], $tplt); $tplt = str_replace("{cat_name}", $menu_cat, $tplt); $tplt = str_replace("{id}", $row_pro[0]['id'], $tplt); $tplt = str_replace("{short desc}", $row_pro[0]['plink'], $tplt); $tplt = str_replace("{date}", $row_pro[0]['pdate'], $tplt); $tplt = str_replace("{image}", $row_pro[0]['image'], $tplt); $tplt = str_replace("{long desc}", $row_pro[0]['pdetail'], $tplt); $tplt = str_replace("{firma}", $row_pro[0]['pfirma'], $tplt); $tplt = str_replace("{dlinks}", $dlinks, $tplt); $con .= $tplt; // Else show list of titles } else { // Number of rows for titles $c_tr_pro = 0; // MVC model for ($p = $start; $p < $start + $add ; $p++) { // put into rows and columns if (($p % 2 == 1) && ($p != 0)) { $tr3 = ''; $tr4 = '</tr><tr>'; $c_tr_pro++; } else { $tr3 = ''; $tr4 = ''; } // if there is no latin name for category get it from fb if($not_pro == 1) { $catlat = $row_pro[$p]['catnamelat']; } // modrewrite support if($chpu == 1) { $link = "<a href=\"{$path}portfolio/cat_{$catlat}/diz{$row_pro[$p]['id']}.html\">"; } else { $link = "<a href=\"{$path}index.php?do=portfolio&cat={$catlat}&id={$row_pro[$p]['id']}\">"; } $content .= " {$tr3} <td width=\"120\" style=\"padding:20px;\" align=\"center\"> $link <img src=\"{$path}uploads/proekts/mini/{$row_pro[$p]['image']}\" width=\"80\" height=\"80\" class=\"min_im\"/></a></td> <td width=\"300\" class=\"description\"> <img src=\"{THEME}/images/pf/arow.gif\" width=\"3\" height=\"6\" align=\"absmiddle\" /> <a href=\"{$path}index.php?do=portfolio&cat={$catlat}&id={$row_pro[$p]['id']}\" title=\"{$row_pro[$p]['pname']}\"> {$row_pro[$p]['pname']} </a> <br /> {$row_pro[$p]['plink']} </td> {$tr4}"; } // add blank cells if needed if ($pro_on_main % 2 == 0) { $add_cell_pro = ''; } else { for ($z = 0; $z < ($pro_on_main - (2 * $c_tr_pro)); $z++) $add_cell_pro .= '<td width=\"120\" style=\"padding:10px;\"> </td> <td width=\"300\" class=\"description\"> </td>'; } $content .= $add_cell_pro; } // Navigation block if(!empty($_REQUEST['cat'])) $catnav = $_REQUEST['cat']; $navigation = navigation($catnav); $con .= <<<HTML {$content} </tr><tr> <td colspan="4" style="text-align:center;"> {$navigation} </td> HTML; // If there is no titles diplay the following message } elseif ($get_count_pro <= 0 && $not_pro == 0) { $con .= '<td><div id="fh3"> - There are no titles in this category - </div></td>'; // If there is no title under a chosen id show this message } elseif (!empty($pro_id) && $not_pro == 0) { $con .= '<td><div id="fh3"> - Title does not exist, must have been deleted - </div></td>'; // If there no titles } else { $con .= '<td><div id="fh3"> - There is currently no titles - </div></td>'; } /******************************** * template block * ********************************/ $tpl -> load_template('portfolio_all.tpl'); $tpl -> set("{MENU_CATEGORY}", $cat_menu); $tpl -> set("{INFO_MODUL}", $modul_info); $tpl -> set("{CONTENT}", $con); $tpl -> set("{PATH}", $path); $tpl -> compile('content'); $tpl -> clear(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270567 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 i doubt if the $total variable is chaging with odd and even page, echo $total and check if it changes, it should be same for all the pages right ? Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270577 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 you are correct $total does not change it remains 3 on every single page when echoed Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270581 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 so weired really !... you mean.. previous works fine in all the pages, and the next does not appear in the even pages.. echo something inside } elseif ($page != $total && $total != 0) { ... this condition.. echo the $page, if nothing happens restart Apache !!.. not sure what to be done, but there must be something else making this probs... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270587 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 i echo $page inside the elseif ($page != $total && $total != 0) { function and only got "1" on page one, no echo on page 2 or 3 (when i manually accessed it) Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270592 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 restarting apache has no effect Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270601 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 are you incrementing the $page to the new page value ?.. i dont see anywhere that is been done.... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270602 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 // get current page $page = intval(@$_GET['page']); Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270603 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 yes yes.. i do see that sorry about ... will this be a problem ? $start = $page * $pro_on_main - $pro_on_main; change to ............ $start = ($page * $pro_on_main) - $pro_on_main; Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270604 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 added that, same result, i get echo on page 1 then go to page 2 - no echo and only << Previous link is there Next >> is not present at all (not even grayed out) Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270606 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 ok.. for some reason this condition } elseif ($page != $total && $total != 0) { is not satisfying when $page=2.... try to change it to this for time being just to test } elseif ($page == 2) { check if you are getting the next link on the page 2, if it comes.... then i really dont have any idea about this... if it does not come, then that means $page is not incrementing.... there must be some problem in declaration... you said you see the Previous.. what page number you are seeing when you rollover on it on the page 2 .. it should be 1 .. try to pass the $page as a parameter to the function and check if that helps... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270618 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 i changed } elseif ($page != $total && $total != 0) { to } elseif ($page == 2) { and Next >> still did not come up...... where could the declaration problem be? Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270623 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 ok ... now try the following.. change this to $page = intval(@$_GET['page']); $page = $_GET['page'];.. make sure you see http://someurl.php?page=2 on the address bar, .. page=2 is important.. echo the $page just after $page = $_GET['page']; check if you see $page echoed as 2 on the second page still not getting.... try to pass the $page as a parameter like navigation($catnav, $page) .... and take the value of the $page from the passed parameter.. Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270627 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 yes i see echo of page 2 now, yet still Next >> does not appear Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270634 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 see.. echo $page outside the function and inside the function and use this condition } elseif ($page == 2) {, it MUST work .. else, somethings wrong somewhere..... and !.. i dunno.... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270636 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 outside of the function echo works, inside the function (even with $page == 2) it does not echo......... > > > what is the problem im so sick of this problem thank you so much for all the help you provided so far, you are soo patient Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270639 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 ok .. better pass the $page as a parameter.. that is what i said before also, like the way you pass $cat, pass the $page also, it should work ... one more thing also you can try ... if($page != 1) $page = 2.. put this inside the function ... it MUST MUST work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...... clealy the value of $page is not coming inside the function, currently you are using global and get the val of page, better pass the $page as a parameter parameter parameter !!!.... okidoki ?... its almost over man ... u know the problem now.. bring the val of $page into the function some how .... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270640 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 you know i have a sneaking suspicion that it is the "elseif" use that is not properly done, i fixed the code at the expense of losing part of modrewrite support, by which i mean this code works perfectly fine: /***************************** * NAVIGATION * *****************************/ function navigation ($cat) { global $page, $total, $pro_id, $chpu, $path; $pervpage = ''; $nextpage = ''; if ($chpu == 1) { $cat = (!empty($cat)) ? $cat = 'cat_'.$cat.'/' : ''; } else { $cat = (!empty($cat)) ? $cat = 'cat='.$cat.'&' : ''; } // Checking whether all arrows are required if ($page != 1) { // modrewrite support if ($chpu == 1) { $pervpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page - 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } else { $pervpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page - 1)." style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } if ($page != $total && $total !=0) { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } // Checking whether forward arrows are requires } elseif ($page == 1) { // modrewrite support if ($chpu == 1) { $nextpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page + 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } else { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } if ($page == 1) { $pervpage = '<span> << Previous </span>'; } } // Menu display $nav_menu = '<div class="link_nav">' .$pervpage. ' ' .$nextpage. '</div>'; // If no ID then display navigation menu if(empty($pro_id)) return $nav_menu; } except the fact that Next >> does not appear on last page as grayed out - it doesnt appear at all..... but thats about the only problem and if modrewrite is on Next >> would probably not appear... Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270643 Share on other sites More sharing options...
rusbb Posted June 8, 2007 Author Share Posted June 8, 2007 another interesting thing: // Checking whether all arrows are required if ($page != 1) { // modrewrite support if ($chpu == 1) { $pervpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page - 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } else { $pervpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page - 1)." style=\"font-weight: normal;text-decoration: underline;\"> << Previous </a></span>"; } if ($page != $total && $total !=0) { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next B>> </a></span>"; } // Checking whether forward arrows are requires } elseif ($page != $total && $total !=0) { echo $page; // modrewrite support if ($chpu == 1) { $nextpage = "<span> <a href=\"{$path}portfolio/{$cat}page_".($page + 1).".html\" style=\"font-weight: normal;text-decoration: underline;\"> Next >> </a></span>"; } else { $nextpage = "<span> <a href= {$path}index.php?do=portfolio&{$cat}page=". ($page + 1)." style=\"font-weight: normal;text-decoration: underline;\"> Next A>> </a></span>"; } if ($page == 1) { $pervpage = '<span> << Previous </span>'; } } i named the two next commands Next A>> and Next B>> and i found that on the first page Next A>> appears, but for every consecutive page Next B>> is used Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270649 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 good man !... some how you made it to work !! Quote Link to comment https://forums.phpfreaks.com/topic/54706-previous-next-page-navigation-problem/#findComment-270652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.