diff --git a/code/FoundationInterchangeControllerExtension.php b/code/FoundationInterchangeControllerExtension.php index ced4c49..31a5e7f 100644 --- a/code/FoundationInterchangeControllerExtension.php +++ b/code/FoundationInterchangeControllerExtension.php @@ -9,7 +9,15 @@ public function onAfterInit() { $vars = $controller->request->getVars(); $partial = (isset($vars[$this->template_param]) && $vars[$this->template_param] != "") ? $vars[$this->template_param] : false; if ($partial) { + // render partial $controller->response->setBody($controller->renderWith($partial)); + // Prevent redirection of /home/ to / if requesting a partial of homepage, + // should happen before $controller->response->output(); + if($this->owner->URLSegment=='home'){ + $this->owner->response->removeHeader('Location'); + $this->owner->response->setStatusCode(200); + } + // output to browser $controller->response->output(); exit(); } @@ -19,4 +27,4 @@ public function InterchangePartial($template) { return $this->owner->Link() . '?' . $this->template_param . '=' . $template; } -} \ No newline at end of file +}