You could use SluggableBehavior in the Page model.

Router::connect(
        '/clienti/:slug',
        array(
                'controller' => 'pages',
                'action' => 'view'
        ),
        array(
                'slug' => '[-a-z]+'
                'pass' => array('slug')
        )
);

And change your controller:

public function view($slug = null)

You could call it "regione" if you like but I like to use the generic
"slug" to make it clear what it is. (I usually have several different
slugs across my routes.)

I included a leading hyphen in the regex so you can have regions like
"emilia-romagna". Also, it expects the slugs to be all lowercase as
this is what SluggableBehavior will do.

On Sun, Aug 26, 2012 at 5:47 AM, Mariano C. <[email protected]> wrote:
> I've a page (i.e. under Pages directory) called dettaglio_regione.ctp. I
> want to set URLs like http://.../clienti/[[regione]], so a working URL
> should be something like http://.../clienti/Campania or
> http://.../clienti/Sicilia and so on.
> I need to grab the content of [[regione]]. How I've to set the route?
>
> --
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to