Monday, February 23, 2009

Pages and Views

Hi everyone,

I'd like to manage my users search functionality on a page called
search, then the end users will be able to access it using the url
www.mywebsite.com/search.

Actually, i already created a search.ctp element with just a form to
process the search on the user table here is the code :

//Search Box
echo $form->create('User',array('action' => 'search'));
echo $form->input('search', array('label' => __('search',true), 'type'
=> 'text'));
echo $form->submit(__('search',true));

The search function is in the search method in the User controller
class, which means the results of the search should actually be
managed in a search view in views/users/search.ctp.

I created a file at this location views/pages/search.ctp and in
routes.php file I have the following connection :
Router::connect('/search', array('controller' => 'pages', 'action' =>
'display', 'search'));
Which means this file is accessible from www.mywebsite.com/search

I'd like the user search to be managed on this file, then the end
users when performing a search will be redirected to view the results
under a url like this www.mywebsite.com/search, including the search
element define before, not a url like www.mywebsite.com/users/search

Is there a way to manage this ? maybe a redirection but I'm completely
stuck at this point.

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

No comments: