Guest stefkay Posted November 15, 2012 Share Posted November 15, 2012 Hey guys, I urgently need your help. Today, my website randomly started displaying this message both in admin and on the store : "Fatal error: Call to undefined function: http_build_query() in /homepages/19/d141433688/htdocs/includes/functions.inc.php on line 471" http://www.test-meter.co.uk/17th-edition-test-equipment/ I have made changes to the code, but these were done weeks ago and the site has been operating fine. Also the problem seems to only be shown on pages which use a pagination function? Any help Much appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
Guest stefkay Posted November 16, 2012 Share Posted November 16, 2012 I increased the amount of products shown per page and the error message has gone, but now no pagination. Is it clearly a pagination error or something more? Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted November 16, 2012 Share Posted November 16, 2012 That call is on the pagination function yes, so if it's not needed, it won't be getting run to that particular step. The function that's missing appears to be a standard one in php 5, I'd have a check to see if you're on an up to date version of php, you can usually find the php info in your admin Quote Link to comment Share on other sites More sharing options...
Guest stefkay Posted November 16, 2012 Share Posted November 16, 2012 Hi, Thanks for your reply, we are currently using php version 4.4.9. How can it work up until now? and is their any fix in which we could stay at our current version of php and have pagination. Thanks Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted November 16, 2012 Share Posted November 16, 2012 The earlier versions of CC4 look like they don't use php5 for that function.. so they -may- work.. not rightly sure. Here's a copy of the entire function, that's in includes/functions.inc.php Try taking a backup of the file then replacing the function, see if it works function paginate($numRows, $maxRows, $pageNum=0, $pageVar='page', $class='txtLink', $limit=5, $excluded = array()) { global $lang; $navigation = ''; // get total pages $totalPages = ceil($numRows/$maxRows); // develop query string minus page vars $queryString = ''; if (!empty($_SERVER['QUERY_STRING'])) { parse_str($_SERVER['QUERY_STRING'], $params); foreach ($params as $key => $value) { if (!array_key_exists($key, $excluded) && strtolower($key) !== strtolower($pageVar)) { # $newParams[$key] = $value; # PHP5 $newParams[] = $key.'='.$value; } } if (!empty($newParams)) { # $queryString = http_build_query($newParams); # PHP 5 $queryString = htmlentities(implode('&', $newParams)); } } ## Get current page # $currentPage = basename($_SERVER['PHP_SELF']); $currentPage = sanitizeVar($_SERVER['PHP_SELF']); ## Build page navigation if ($totalPages> 1) { if(!empty($lang['admin_common']['misc_pages'])) { $pageText = $lang['admin_common']['misc_pages']; } else { $pageText = $lang['front']['misc_pages']; } $navigation = $totalPages.$pageText; $upper_limit = $pageNum + $limit; $lower_limit = $pageNum - $limit; if ($pageNum > 0) { ## Sho, if not the first page if (($pageNum - 2)>0) { $first = sprintf('%s?%s&%s=%d', $currentPage, $queryString, $pageVar, 0); $navigation .= "<a href='".$first."' class='".$class."'>«</a> "; } $prev = sprintf('%s?%s&%s=%d', $currentPage, $queryString, $pageVar, max(0, $pageNum - 1)); $navigation .= "<a href='".$prev."' class='".$class."'><</a> "; } ## get in between pages for ($i = 0; $i < $totalPages; $i++) { $pageNo = $i+1; if ($i==$pageNum) { $navigation .= " <strong>[".$pageNo."]</strong> "; } else if ($i!==$pageNum && $i<$upper_limit && $i>$lower_limit) { $noLink = sprintf('%s?%s&%s=%d', $currentPage, $queryString, $pageVar, $i); $navigation .= " <a href='".$noLink."' class='".$class."'>".$pageNo."</a> "; } else if (($i - $lower_limit)==0) { $navigation .= "…"; } } if (($pageNum+1) < $totalPages) { // Show if not last page $next = sprintf('%s?%s&%s=%d', $currentPage, $queryString, $pageVar, min($totalPages, $pageNum + 1)); $navigation .= "<a href='".$next."' class='".$class."'>></a> "; if (($pageNum + 3)<$totalPages) { $last = sprintf('%s?%s&%s=%d', $currentPage, $queryString, $pageVar, $totalPages-1); $navigation .= "<a href='".$last."' class='".$class."'>»</a>"; } } } return $navigation; } Quote Link to comment Share on other sites More sharing options...
Guest stefkay Posted November 16, 2012 Share Posted November 16, 2012 Thanks for your help. I'll be testing this code on Monday when i'm back in the office and let you know. But thanks for your time. Stefan Quote Link to comment Share on other sites More sharing options...
Guest stefkay Posted November 19, 2012 Share Posted November 19, 2012 Mate that code has worked, thanks for your help. It's weird how the code can be working one day and not the other? Thanks Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted November 19, 2012 Share Posted November 19, 2012 I'm guessing it just wasn't getting into that particular section of the pagination function for whatever reason, like if you only had a single page of things.. either that or your server spontaneously jumped back a version.. oh well, good to hear it fixed it anyhow Quote Link to comment 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.