Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-16-2007, 05:25 AM
Junior Member
 
Join Date: Feb 2007
Posts: 26
Default Friendly URL suggestion.

I use ZF 1.0 RC2
Right. I've been digging more, I created a Module Note, so when I type:
http://myweb/note/archive/2007 I get all Notes from 2007.
http://myweb/note/archive/2007-06 I get all Notes from June 2007
http://myweb/note/archive/2007-06-11 I get all Notes from 11 June 2007, finally
http://myweb/note/archive/2007-06-11/1-someTitle.html I get the Note Content.

For that, I created a Router like this:

Code:
$route = new Zend_Controller_Router_Route_Regex(
    	'note/archive(?:/(\d+)(?:-(\d+)(?:-(\d+)(?:/(\d+)-(.+)html?)?)?)?)',
    	array(
    		'module'    => 'note',
        	'controller' => 'archive', 
        	'action'      => 'view',
    	), 
    	array(
        	1 => 'year', 
        	2 => 'month',
        	3 => 'day',
        	4 => 'nid',
        	5 => 'title'
    	),
    	'note/archive/%d-%d-%d-%d-%s.html'
);

$router = new Zend_Controller_Router_Rewrite();
$router->addRoute('noteArchiveView', $route);

$frontController = Zend_Controller_Front::getInstance();
$frontController->addModuleDirectory('app/modules');
$frontController->throwExceptions(true);
$frontController->setRouter($router);

$frontController->dispatch();
So please any suggestion thx a lot

Last edited by Tommy1402 : 06-16-2007 at 05:31 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:36 PM.