Re: Renamed Controller Issues
Yeah, I tried all of those, and none of them were working for me, but I noticed further down on the page in the link that was supplied by Joel that there was a section called Custom Inflections, and so I edited /config/inflections and added 'vinny' to the $uninflectedPlural var. It works now, and thanks for everybody's help. On May 15, 2:06 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote: > On Thu, May 15, 2008 at 4:00 PM, benjam <[EMAIL PROTECTED]> wrote: > > > That's a big help, but not enough to fix the issue. In fact just the > > opposite. > > I'm not trying to adjust the controller to the URL, I'm trying to > > adjust the URL in the controller. > > > The issue I'm having is when I tell Cake that I want to use the > > 'Vinny' Controller, it runs off and grabs VinnyController, but then > > tries to forward that to /vinnies/ instead of /vinny/. > > > For instance, when I create a form using $form->create('Vinny'); in > > the form, as the action attribute of the tag, it has "/vinnies/add". > > The URL I am using is /vinny/ask. > > Try this (if you haven't already): > > * Call your controller VinniesController. > * set up a route: Router::connect('/vinny/ask', > array('controller'=>'vinnies', 'action'=>'add')); > > With any luck, the reverse routing lookup will automatically fix your > URL. If it doesn't, the following addition should work: > > * $form->create('Vinny', array('controller'=>'vinnies', 'action'=>'add')); > > again, it should pick up the association and you'll be off to the races. > > Alternatively, set up a VinnyController and manually do > array('controller'=>'vinny', 'action'=>'ask'). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Renamed Controller Issues
On Thu, May 15, 2008 at 4:00 PM, benjam <[EMAIL PROTECTED]> wrote: > > That's a big help, but not enough to fix the issue. In fact just the > opposite. > I'm not trying to adjust the controller to the URL, I'm trying to > adjust the URL in the controller. > > The issue I'm having is when I tell Cake that I want to use the > 'Vinny' Controller, it runs off and grabs VinnyController, but then > tries to forward that to /vinnies/ instead of /vinny/. > > For instance, when I create a form using $form->create('Vinny'); in > the form, as the action attribute of the tag, it has "/vinnies/add". > The URL I am using is /vinny/ask. Try this (if you haven't already): * Call your controller VinniesController. * set up a route: Router::connect('/vinny/ask', array('controller'=>'vinnies', 'action'=>'add')); With any luck, the reverse routing lookup will automatically fix your URL. If it doesn't, the following addition should work: * $form->create('Vinny', array('controller'=>'vinnies', 'action'=>'add')); again, it should pick up the association and you'll be off to the races. Alternatively, set up a VinnyController and manually do array('controller'=>'vinny', 'action'=>'ask'). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Renamed Controller Issues
That's a big help, but not enough to fix the issue. In fact just the opposite. I'm not trying to adjust the controller to the URL, I'm trying to adjust the URL in the controller. The issue I'm having is when I tell Cake that I want to use the 'Vinny' Controller, it runs off and grabs VinnyController, but then tries to forward that to /vinnies/ instead of /vinny/. For instance, when I create a form using $form->create('Vinny'); in the form, as the action attribute of the tag, it has "/vinnies/add". The URL I am using is /vinny/ask. Now I can fix the "/add" part by adding array('action' => 'ask') to the create from method, but it is still setting "/vinnies/ask" as the action, which is close, but not quite right. And now I have found out that $form->here does not work for instances where the main site script is not in the root directory of the server. Thanks for the info though. On May 15, 10:23 am, Joel Perras <[EMAIL PROTECTED]> wrote: > http://book.cakephp.org/view/39/configuration#routes-configuration-46 > > -Joel. > > On May 15, 11:18 am, benjam <[EMAIL PROTECTED]> wrote: > > > I have a section of my site called 'Ask Vinny' and I would like the > > URL to look something like mysite.com/vinny (not mysite.com/vinnies) > > so I renamed the controller and moved the views into the vinny/ dir, > > and it works fine, except that when submitting the 'ask question' form > > ( @ vinny/ask), it tries to submit to vinnies/add instead of vinny/ > > ask. > > > I fixed the ask part by setting 'action' => 'ask' in the $form->create > > options array, but when I tried to set the controller, it still goes > > to vinnies/ask, and not vinny/ask. > > > I finally got it working by setting 'url' => $form->here in the > > options, but I don't want to have to do this for every form I create. > > > Is there a way to set something in the controller (or anywhere, the > > model maybe?) that tells it not to pluralize the controller name when > > going to dynamically created URLs? Or a way to set the controller > > (or model) up so that it knows to go to vinny/ and not vinnies/? > > > Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Renamed Controller Issues
http://book.cakephp.org/view/39/configuration#routes-configuration-46 -Joel. On May 15, 11:18 am, benjam <[EMAIL PROTECTED]> wrote: > I have a section of my site called 'Ask Vinny' and I would like the > URL to look something like mysite.com/vinny (not mysite.com/vinnies) > so I renamed the controller and moved the views into the vinny/ dir, > and it works fine, except that when submitting the 'ask question' form > ( @ vinny/ask), it tries to submit to vinnies/add instead of vinny/ > ask. > > I fixed the ask part by setting 'action' => 'ask' in the $form->create > options array, but when I tried to set the controller, it still goes > to vinnies/ask, and not vinny/ask. > > I finally got it working by setting 'url' => $form->here in the > options, but I don't want to have to do this for every form I create. > > Is there a way to set something in the controller (or anywhere, the > model maybe?) that tells it not to pluralize the controller name when > going to dynamically created URLs? Or a way to set the controller > (or model) up so that it knows to go to vinny/ and not vinnies/? > > Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Renamed Controller Issues
I have a section of my site called 'Ask Vinny' and I would like the URL to look something like mysite.com/vinny (not mysite.com/vinnies) so I renamed the controller and moved the views into the vinny/ dir, and it works fine, except that when submitting the 'ask question' form ( @ vinny/ask), it tries to submit to vinnies/add instead of vinny/ ask. I fixed the ask part by setting 'action' => 'ask' in the $form->create options array, but when I tried to set the controller, it still goes to vinnies/ask, and not vinny/ask. I finally got it working by setting 'url' => $form->here in the options, but I don't want to have to do this for every form I create. Is there a way to set something in the controller (or anywhere, the model maybe?) that tells it not to pluralize the controller name when going to dynamically created URLs? Or a way to set the controller (or model) up so that it knows to go to vinny/ and not vinnies/? Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---