Modular Zend Framework with Partial Database

Currently, I find that I need to duplicate partial modules for different modules.

I would like to have a case directory for all partial files that will be available.

Does anyone have a good way to do this?

thanks

+7
zend-framework partials
source share
2 answers
$this->partial('directoryOfPartials/partial.phtml', $model); 

I think you can also use $ this-> partial with three arguments. The second argument is the name of the module, and the third argument becomes the model.

Photographed from: http://framework.zend.com/manual/en/zend.view.helpers.html

Example # 10 Providing partial data to Other modules Once partially exist in another module. if you know the name of the module, you can pass it as the second argument to either partial () or partialLoop (), moving the $ model argument to the third position. For example, if there is a partial pager that you want to use in the "list" module, you can capture it as follows:

 <?php echo $this->partial('pager.phtml', 'list', $pagerData) ?> 

Thus, you can reuse partial ones created specifically for other modules. However, it is probably a better practice to reuse partial paths in a generic way script path.

EDIT - access to partial views within the scope of the controller

 $this->view->getHelper('partial')->partial('comments.phtml'); 
+8
source share

Thanks a lot :)

However, how to do this using a controller? I have fancybox and configured ajax layout:

 $this->view->layout()->setLayout('ajax'); $errors = array('You have lost your rights to download this clip, you have downloaded it the maximum amount of times.'); $this->render($this->view->partial('partials/errors.phtml', 'default', array('errors' => $errors)), NULL, true); 

A popup window is necessary, but with the following error:

 Problem: Method "partial" does not exist and was not trapped in __call() 

I assumed that the partial expression this this → view-> would be the same as using $ this-> partial inside the view template, but I think not. Ideas?

PERFORMANCE ORDER:

Bootstrap initView, added:

 $view->addScriptPath('../application/layouts/partials'); 

Moved my partial files to this directory. Then in my controller, I:

 $this->view->layout()->setLayout('ajax'); $this->view->form = $form; $this->renderScript('login.phtml'); 

Thank you for #zftalks SmartSsa

+2
source share

All Articles