Put multiple URL segments in 1 variable with Zend

For a new application, I would like to work with a URI to determine what content should be loaded. So far, nothing special ... But how can I let slug have the slash (s) in it and make sure that the Zend Framework sees them as 1 variable? ZF splits the requested URL into pieces, where each part is a line between two abbreviations. Now I would like to have all the parts in 1 variable for work.

Example:

/ de / my / page

de> language
my / page> 1 variable

Any ideas?

+3
source share
3 answers

Hari K - , , Zend_Controller_Router_Route_Regex, , , :

$routetotry = new Zend_Controller_Router_Route_Regex('([^/]+)/(.*)',
                    array(1 => 'de', 'controller' => 'someController', 'action' => 'someAction'),
                    array(1 => 'lang',2=>'my_variable_with_slash'),
                    '%s/%s'
);

$router->addRoute('routetotry', $routetotry);
+1

. , : (

+1

Replace the slashes in the bullet with another value of your choice.

For example, a hyphen (-) or an underscore (_).

0
source

All Articles