cgm225 Posted March 30, 2008 Share Posted March 30, 2008 I have the following line of code... FrontController::createInstance()->dispatch(); However, none of the code after it seems to get rendered/parsed. So, for example, the following would echo nothing... FrontController::createInstance()->dispatch(); echo "Testing"; I have included my FrontController class here in case it is the source of the problem: <?php require_once PAGE_DIR . "/ActionController.php5"; class FrontController { //Checking if the PAGE_DIR variable is defined public static function createInstance() { if (!defined("PAGE_DIR")) { exit("Critical error: Cannot proceed without PAGE_DIR."); } $instance = new self(); return $instance; } public function dispatch() { //The next two lines are ternary operators, a sort of short-hand for if-else $page = !empty($_GET["page"]) ? $_GET["page"] : "home"; $action = !empty($_GET["action"]) ? $_GET["action"] : "index"; //example GuestbookActions $class = ucfirst($page) . "Actions"; //e.g. guestbook/GuestbookActions.php5 $file = PAGE_DIR . "/" . $page . "/" . $class . ".php5"; if (!is_file($file)) { exit("Page not found"); } //Requiring the Actions file require_once $file; //Creating a new object $controller = new $class(); //Using the setName variable from the ActionController class in ActionController.php5 $controller->setName($page); //Checks if the method exists, then runs the displayView action $controller->dispatchAction($action); } } ?> Link to comment https://forums.phpfreaks.com/topic/98696-code-after-this-line-not-being-parsed/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2008 Share Posted March 30, 2008 You are probably getting a fatal runtime error or your code is otherwise exiting without displaying any helpful message. Add the following two lines after your first opening <?php tag to get php to help you - ini_set ("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/98696-code-after-this-line-not-being-parsed/#findComment-505102 Share on other sites More sharing options...
cgm225 Posted March 30, 2008 Author Share Posted March 30, 2008 Adding that returns no errors... Any other ideas? (Thanks again for the help!) Link to comment https://forums.phpfreaks.com/topic/98696-code-after-this-line-not-being-parsed/#findComment-505109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.