Use a route:

Router::connect(
        '/:number_code',
        array(
                'controller' => 'numbers',
                'action' => 'view'
        ),
        array(
                'number_code' => '[0-9]{3}-[0-9]{3}-[0-9]{4}',
                'pass' => array('number_code')
        )
);

function view($number_code = null)
{
        ...
}

What that does is specify that any URL consisting of exactly 3 digits,
a dash, 3 digits, another dash, followed by 4 digits should be
directed to NumbersController:view(). If the code does not always
follow that same scheme you'll need to describe a regexp that will
always match.

You can name number_code whatever you like. The 'pass' part of the
route says that the matching number should be passed as a parameter to
the controller method. If not, you'll have to look for it in $this-
>params.

When creating links using HtmlHelper, do it like:

$html->link(
        'whatever',
        array(
                'controller' => 'numbers',
                'action' => 'view',
                'number_code' => $your_number_code
        ),
        array('title' => 'my fancy link')
);

On Mar 17, 3:51 pm, thankyou <[email protected]> wrote:
> Hi ,
> I have a cakephp application where there's a 
> link:http://www.mywebsite.com/numbers/view/112-332-3322-- BTW...there are
> a variety of numbers after view/ not just 112-332-3322
>
> I would like to make that viewable to the users 
> as:http://www.mywebsite.com/112-332-3322
>
> Is there a way to use mod-rewrite to make this happen?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to