Zend Framework Action: URL Structure and ControllerTag: framework, zend, zend framework, actions, url structure, controller Category: PHP Frameworkpost: 11 Apr 2008 read: 569 Zend Framework Action Step By Step Tutorial - Part 2: URL is important part when we develop web application. We use them for jump between pages. As we know, every framework have rule about URL. It is a key to understanding how the framework works. Now, we will talk rule at Zend Framework. Zend Framework breaks URL into pieces. Those pieces are laid out as follows: http://hostname/controller/action/parametes. Look at our url that we used to access hello page: http://localhost/test/zend/helloworld/web_root/. Assume http://hostname is same with http://localhost/test/zend/helloworld/web_root/. Next path is controller. Try to point your browser to http://localhost/test/zend/helloworld/web_root/index. We get same with http://localhost/test/zend/helloworld/web_root/. Why? as default, http://localhost/test/zend/helloworld/web_root/ will access index controller. Can you catch idea? I know, you don't patient to test with other controller. How about we use other controller named "user"? Never mind. From theory above, we will access with http://localhost/test/zend/helloworld/web_root/user. Let's do it. First, create controller name "UserController". Create a file named "UserController" within application/controllers. Enter following code:
Next, create a folder named "user" within helloworld\application\views\scripts. Create a file named "index.phtml" within user. Enter following code:
Now, point your browser to http://localhost/test/zend/helloworld/web_root/user.
| ||
| | Give Your Opinion | Recommend |
|

