3

Zend newbie here.

I have an admin folder in my View linked to an admin controller, but I need a sub folder(s) within the admin view to handle various functions.

For example: views/scripts/admin and I also want views/scripts/admin/linksfunction or views/scripts/admin/adduserfunction.

My question is, how do I hook these subdirectories with my controllers? I'm looking to handle the functions either within the AdminController or even separate controllers. Does anybody know how I would accomplish this?

tereško
  • 58,060
  • 25
  • 98
  • 150

1 Answers1

0

There are several methods for accomplishing this.

If you have an action for each functionality (adduserfunction & linksfunction), you can use viewAction helper Action View Helper
From views/scripts/admin.index.phtml call echo $this->action('adduserfunction', 'admin') and echo $this->action( 'linksfunction', 'admin'). This will render the whole action to the view. It is very straightforward and handy. But view action helpers are considered to be very expensive. Check this ZF Manual performance.view.action

Another method is to use Actionstack where you can add more than one action to a stack and execute it sequentially.

Another method is to use either Partial Helper or Zend_View's render(). Use partial() only when really necessary, because it is very expensive.

These are few sources that will help you
When to use viewscripts/partials vs view helpers
Why the Zend Framework Actionstack is Evil

Community
  • 1
  • 1
Nandakumar V
  • 4,317
  • 4
  • 27
  • 47