Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //create a new view renderer if not exists
- $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
- if (null === $viewRenderer->view)
- {
- $viewRenderer->initView();
- }
- $view = $viewRenderer->view;
- //generate the file paths
- $module_path = APP_DIR . DS . 'modules' . DS . $module . DS . 'views';
- $module_file = $module_path . DS . 'scripts' . DS . $controller . DS . $action . '.phtml';
- $template_path = ROOT_DIR . DS . 'templates' . DS . $template . DS . 'views' . DS . $module;
- $template_file = $template_path . DS . 'scripts' . DS . $controller . DS . $action . '.phtml';
- //set the script path to the right template
- if (file_exists( realpath($template_file) ))
- {
- $view->setScriptPath( realpath($template_path . DS . 'scripts') );
- //add the helper path
- if (file_exists($template_path . DS . 'helpers'))
- {
- $view->addHelperPath($template_path . DS . 'helpers', $module . '_View_Helper_');
- }
- } else if (file_exists( realpath($module_file) ))
- {
- $view->setScriptPath( realpath($module_path . DS . 'scripts') );
- //add the helper path
- if (file_exists($module_path . DS . 'helpers'))
- {
- $view->addHelperPath($template_path . DS . 'helpers', $module . '_View_Helper_');
- }
- }
- echo '<pre>';
- var_dump( realpath($template_file) );
- var_dump( realpath($module_file) );
- var_dump( realpath($template_path . DS . 'scripts' . DS) );
- var_dump( realpath($module_path . DS . 'scripts' . DS) );
- var_dump( file_exists( realpath($template_file) ) );
- var_dump( file_exists( realpath($module_file) ) );
- echo '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement