another thing in ZF

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
the_last_tamurai
Forum Commoner
Posts: 87
Joined: Wed Feb 28, 2007 8:24 am
Location: cairo
Contact:

another thing in ZF

Post by the_last_tamurai »

I'm working with zend framework.....

well , How can I go with deep urls

I have this URL (done)
Example:
I make a controller named adminController.php with some actions inside
like settings ,etc...
if I want to make an action like users and with ctions inside like add/update/delete
looks like :
how can I make that..... :oops:
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

I believe the standard Rewrite Router has up to three levels by default (module, controller, action) (Zend Framework version 0.8, 0.7 didn't have the moldule). Once you get past that level, you start looking at parameters which can be any number as far as I am aware. The main difficulty is figuring out which things are required and what is not is you not want parameters is pairs.

The maximum amount of parameters I have passed is two... A "category" and a page with category defaulted required if you want a page..

Simple example

Code: Select all

Browse = Search/Browse/category/0/page/1
Browse/:category = Search/Browse/category/0/page/1
Browse/:category/:page = Search/Browse/category/0/page/1
Before the equals sign is the URL, The information after the equals is the information passed to the Zend_Controller_Rewrite_Router.
Search is the controller used, Browse is the action and :category and :page are the parameters. (I do not use modules as I haven't yet upgraded).

You may want to look at
Zend Controller and
Zend_Controller_Router_Rewrite
for more information.

Oh I forgot (as it took me a bit of time to find it)...
In my controller/action method I use

Code: Select all

$settings=$this->getRequest()->getParams(); // returns an indexed array of all parameters.
$category=$settings['category']; // not really used but shows how you can get the information
$page=$settings['page']; // not really used but shows how you can get the information
User avatar
the_last_tamurai
Forum Commoner
Posts: 87
Joined: Wed Feb 28, 2007 8:24 am
Location: cairo
Contact:

Post by the_last_tamurai »

thank u very much...really I didn't read the manual about Zend_Controller_Router_Rewrite .
I saw it but I'm very lazy :D said to myself:"mayebe another time,work now with the basics",I realize now its basic to know about it
so, now I'll start...
Post Reply