Forums
This topic is locked
Undefined index: actual in /var/www/hay/controller/main.php on line 36
Posted 15 Nov 2011 19:54:12
1
has voted
15 Nov 2011 19:54:12 miguel angel posted:
I have this code yet still have an error, class Main { private static $pages = Array( 'rolunk' => 1, 'paprikahaz' => 2, 'lovagrend' => 3, 'kapcsolat' => 4, 'actual' => 5 ); public static function index() { if (!isset($GLOBALS['url'][0])) { Util::redirect('/actual'); } else { $page = $GLOBALS['url'][0]; Util::setHeaders(); if (array_key_exists($page, self::$pages)) { $article = Articles::getPage(self::$pages[$page]); if (is_numeric($article['gallery_id'])) { TPL::getInstance()->assign('gallery_id', $article['gallery_id']); TPL::getInstance()->assign('gallery_image', Util::$gallery_image[$page]); ------> line 36? } TPL::getInstance()->assign('actual', true); TPL::getInstance()->assign('article_title', stripcslashes($article['title'])); TPL::getInstance()->assign('article_seo_title', stripcslashes($article['seo_title'])); TPL::getInstance()->assign('article_keywords', stripcslashes($article['seo_keywords'])); TPL::getInstance()->assign('article_desc', stripcslashes($article['seo_description'])); TPL::getInstance()->assign('article_body', stripcslashes($article['body'])); } } }
[v]
Anybody can help me in this one!
Replies
Replied 28 Nov 2011 18:47:43
28 Nov 2011 18:47:43 Patrick Woldberg replied:
The error tells you that the array index does not exist, so the $page probably contains a value that is not an index of the $gallery_image array.
Print out the $page and $gallery_image for debugging the problem (use print_r to print the array).
Print out the $page and $gallery_image for debugging the problem (use print_r to print the array).