madvic Wrote:OK, Thanks for issues.
Definition :
'QUERY_STRING'
The query string, if any, via which the page was accessed.
But if query string not exist ? -> error.
The correction :
/*******************************************************
* @function show_articles
* @action runs the news plugin on the theme/site page
*/
function show_articles($n = NULL) {
$articles = get_articles();
if (isset($n) && $n > 0) {
$index = (isset($_GET['page'])) ? $_GET['page'] : 0;
$pages = array_chunk($articles, $n);
if (count($pages) > 0){
$articles = $pages[$index];
}
}
foreach ($articles as $article) {
$id = basename($article, ".xml");
show_single($id);
}
if (isset($n) && $n > 0)
show_navigation($index, sizeof($pages));
}
/*******************************************************
* @function show_navigation
* @action provides links to navigate between article pages
*/
function show_navigation($index, $pages) {
$queryString = "";
if (isset($_SERVER['QUERY_STRING'])){
$queryString = $_SERVER['QUERY_STRING'];
}
$query_string = preg_replace('/&?page=-?\d+/', '', $queryString);
if (strlen($query_string) == 0) {
$url = $_SERVER['PHP_SELF'];
$delimiter = '?';
} else {
$url = $_SERVER['PHP_SELF'] . '?' . $query_string;
$delimiter = '&';
}
....