3

Here is the code I have:

$this->getView()->setScriptPath($templatePath);
$this->_helper->viewRenderer($page);

This code is handled in the Core_PageController view action. The problem I have is now the view object looks for my script files in $templatePath/page since page is the controller. What I'd like is for the view object to look in just the $templatePath directory path (without the page directory);

Thanks for the help!

1 Answer 1

4

You can instruct the ViewRenderer to not use the controller name as part of the view script path.

To do that, try:

$this->_helper
     ->viewRenderer
     ->setNoController(true); // do not use controller name as part of the view path

setNoController($flag = true) can be used to tell render() not to look for the action script in a subdirectory named after the controller (which is the default behaviour). getNoController() retrieves the current value.

More info on the ViewRenderer helper.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.