I have a problem and wondering if there is a quick solution to this.
 
In my routes i have:
Router::connect('/journals/:entry_key', array('controller' => 'journals',
'action' => 'view'),array('entry_key' => '[-_A-Za-z0-9]+','pass' =>
array('entry_key')));
which works fine.
 
In the view i have a AJAX link to save the page as a bookmark which also
works perfect.
 
Issue is if i firebug the link that renders journals/save/58gh26 and edit
the link to journals/save/ removing the entry_id and try saving, Cake thinks
"save" is a entry_key and renders a blank entry page into the div where
"Saved" message would normally appear because the is no entry called "save"
 
I tried adding this to the controller inside the if
($this->RequestHandler->isAjax()) {
if (empty($entry_key)) {
                  $this->layout = 'ajax';
                  $this->render('/errors/entry_error');
              }
But it seems the routes is still taking over because the empty journal page
loads.
 
My question is how can i ensure that if the entry_id is removed by the user
messing around that it renders an error rather than what it is currently
doing?
 
I was thinking a work around may be adding a route to journal/save to
'controller' => 'journals', 'action' => 'error'
 
and make a error function inside the controller to render either the Ajax
error or standard html error page depending on how the user arrived to
journals/save
 
Would that be the best option? Does not seem like the best way I am sure
there must be an easier way...
 
open to ideas, suggestions please
 
Thanks
 
Dave 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to