2
votes

I was going through the Zend document but I didn't get clear idea how routing is done in Zend framework 1.12.

What I understand from the document is when we hit the URL in the browser then request is going the index.php in public folder.

But I am not getting how Zend framework decomposes the URL and calls the particular controller and action.

Eg. consider the URL: http://zendtutorial.local/blog/new

How Zend evaluates newAction from BlogController

1
If you have the choice, I suggest not to put too much effort in ZF1. The architecture is outdated and many components are buggy. I suggest you to have a look into ZF3/Zend-Express or rather Symfony. - Daniel W.
You are right. But I am working on the project where we are using the old Zend framework version i.e. 1.12, Hence I have no choice :( . - Mac
Oh I feel pity for you, I know the struggle :) Good luck - Daniel W.

1 Answers

2
votes

When We hit the URL First following things happens:

  1. Very first index.php in public directory gets called.
  2. In Index.php the constants like APPLICATION_PATH, APPLICATION_ENV are defined and Application object gets created.
  3. The settings in the application.ini file get initialized.
    • application.ini contains all the information like the default controller, default modules, database settings, etc.
  4. Then the bootstrap function of Zend_Application gets called.
  5. This function calls the Bootstrap class from bootstrap.php.
  6. Then run() method of Zend_Application_Bootstrap_Bootstrap gets called.
    • Zend_Application_Bootstrap_Bootstrap :: run() method gets called.
  7. Finally, dispatch() method of Zend_Controller_Front gets called.
  8. dispatch() method routes the requested URL to specific controller and action.