Re: Route question

2010-09-01 Thread Miles J
You could try using a custom route class:

http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp

http://cakedc.com/eng/pierre_martin/2010/08/05/i18n-routes-with-cakephp-1-3

On Aug 31, 10:27 am, cricket zijn.digi...@gmail.com wrote:
 2010/8/30 Harald Martin Bråttbåkk wynksaiddest...@googlemail.com:

  Hello,

  i simply want to change the default routing pattern http://
  example.com/controller/action/param1/param2/param3 into http://
  example.com/param1/controller/action/param2/param3. Is there a simple
  way to do this?

 I'm not sure about doing it with generic controller and action. Also,
 the regular expressions necessary will depend on what the params are
 expected to be. For example, if you wanted URLs like so:

 http://www.whatever.com/en/catalogs/some_string123/456

 Router::connect(
         '/:param1/catalogs/:param2/:param3',
         array(
                 'controller' = 'catalogs',
                 'action' = 'view'
         ),
         array(
                 'param1' = '[a-z]{2}',
                 'param2' = '[_a-z0-9]+',
                 'param3' = '[0-9]+'
                 'pass' = array(
                         'param1', 'param2', 'param3'
                 )
         )
 );

 function view($param1, $param2, $param3) { ... }

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Route question

2010-08-31 Thread cricket
2010/8/30 Harald Martin Bråttbåkk wynksaiddest...@googlemail.com:
 Hello,

 i simply want to change the default routing pattern http://
 example.com/controller/action/param1/param2/param3 into http://
 example.com/param1/controller/action/param2/param3. Is there a simple
 way to do this?

I'm not sure about doing it with generic controller and action. Also,
the regular expressions necessary will depend on what the params are
expected to be. For example, if you wanted URLs like so:

http://www.whatever.com/en/catalogs/some_string123/456

Router::connect(
'/:param1/catalogs/:param2/:param3',
array(
'controller' = 'catalogs',
'action' = 'view'
),
array(
'param1' = '[a-z]{2}',
'param2' = '[_a-z0-9]+',
'param3' = '[0-9]+'
'pass' = array(
'param1', 'param2', 'param3'
)
)
);

function view($param1, $param2, $param3) { ... }

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Route question

2010-08-16 Thread Dr. Loboto
?php echo $this-Html-link(__('View', true), array('controller' =
'galleries' , 'action' = 'view', 'gal_slug' = $gallery['Gallery']
['slug'])); ?

On Aug 16, 8:02 am, Dave Maharaj m...@davemaharaj.com wrote:
 I have my gallery controller and each gallery has a slug so the url looks
 like gallery/fishing (if manually typed in)

 Routed like - Router::connect('/gallery/:gal_slug',array('controller' =
 'galleries' , 'action' = 'view'), array( 'gal_slug' =
 '[-_A-Za-z0-9]+','pass' = array('gal_slug' ) ) );

 Then in my gallery index.ctp I have ?php echo $this-Html-link(__('View',
 true), array('controller' = 'galleries' , 'action' = 'view',
 $gallery['Gallery']['slug'])); ? but the url when hover/clicked over the
 link shows view -  gallery/view/fishing.

 How can I get it so it removes the view from the url?

 Thanks

 Dave

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Route question

2010-08-16 Thread Dave Maharaj
Thanks guys.

Dave

-Original Message-
From: Dr. Loboto [mailto:drlob...@gmail.com] 
Sent: August-16-10 4:10 AM
To: CakePHP
Subject: Re: Route question

?php echo $this-Html-link(__('View', true), array('controller' =
'galleries' , 'action' = 'view', 'gal_slug' = $gallery['Gallery']
['slug'])); ?

On Aug 16, 8:02 am, Dave Maharaj m...@davemaharaj.com wrote:
 I have my gallery controller and each gallery has a slug so the url looks
 like gallery/fishing (if manually typed in)

 Routed like - Router::connect('/gallery/:gal_slug',array('controller' =
 'galleries' , 'action' = 'view'), array( 'gal_slug' =
 '[-_A-Za-z0-9]+','pass' = array('gal_slug' ) ) );

 Then in my gallery index.ctp I have ?php echo
$this-Html-link(__('View',
 true), array('controller' = 'galleries' , 'action' = 'view',
 $gallery['Gallery']['slug'])); ? but the url when hover/clicked over the
 link shows view -  gallery/view/fishing.

 How can I get it so it removes the view from the url?

 Thanks

 Dave

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Route question

2010-08-15 Thread mark_story
The problem is that in your link you don't use the 'gal_slug' key for
the array.  So the router doesn't understand that you mean it to be a
gal_slug route.  The pass key in the options, isn't bidirectional
unfortunately.

-Mark

On Aug 15, 9:02 pm, Dave Maharaj m...@davemaharaj.com wrote:
 I have my gallery controller and each gallery has a slug so the url looks
 like gallery/fishing (if manually typed in)

 Routed like - Router::connect('/gallery/:gal_slug',array('controller' =
 'galleries' , 'action' = 'view'), array( 'gal_slug' =
 '[-_A-Za-z0-9]+','pass' = array('gal_slug' ) ) );

 Then in my gallery index.ctp I have ?php echo $this-Html-link(__('View',
 true), array('controller' = 'galleries' , 'action' = 'view',
 $gallery['Gallery']['slug'])); ? but the url when hover/clicked over the
 link shows view -  gallery/view/fishing.

 How can I get it so it removes the view from the url?

 Thanks

 Dave

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Route question

2008-01-31 Thread Ron Chaplin
The third parameter is what should be passed to the controller=action.

You might simply try Router::connect('/', array('controller' = 'users',
'action' ='index'));

Also be sure that the view index.thtml (1.2 -- index.ctp) is created
in /app/views/users/

On Thu, 2008-01-31 at 21:54 +0700, Feris Thia wrote:

 Hi,
 
 Is the third parameter in to setup route in routes.php become useless
 in CakePHP 1.2 ?
 
 I try to use another ctp file (instead of action method related
 template) with this syntax :
 
 =
 Router::connect('/', array('controller' = 'users', 'action' =
 'index', 'index3'));
 =
 
 But it did not try to use index3.ctp and istead cake issue an error :
 
 =
 Missing view
 
 You are seeing this error because the view for
 UsersController::index(), could not be found.
 =
 
 Regards,
 
 Feris
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Route question

2008-01-31 Thread Feris Thia

Hi Ron,

Yes... the view is already created. I try to experiment with the third
parameter. So I've got wrong concept about it, thought it was the
template to be used by the controller.

Thanks !

Feris

On 1/31/08, Ron Chaplin [EMAIL PROTECTED] wrote:

  The third parameter is what should be passed to the controller=action.

  You might simply try Router::connect('/', array('controller' = 'users',
 'action' ='index'));

  Also be sure that the view index.thtml (1.2 -- index.ctp) is created in
 /app/views/users/


  On Thu, 2008-01-31 at 21:54 +0700, Feris Thia wrote:
  Hi,

 Is the third parameter in to setup route in routes.php become useless
 in CakePHP 1.2 ?

 I try to use another ctp file (instead of action method related
 template) with this syntax :

 =
 Router::connect('/', array('controller' = 'users', 'action' =
 'index', 'index3'));
 =

 But it did not try to use index3.ctp and istead cake issue an error :

 =
 Missing view

 You are seeing this error because the view for
 UsersController::index(), could not be found.
 =

 Regards,

 Feris




  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---