Dunno about 'best', but this works:
In your view (search.ctp)
<?php echo $form->create("Model", array("action"=>"search",
"type"=>"get") ?>
<?php echo $form->input("search_for") ?>
<?php echo $form->end("Search") ?>
<?php foreach($results as $result) : ?>
... output your result here
<?php endif; ?>
In your controller:
function search() {
if (isset($this->params['url']['search_for'])) {
$scope = array("@[EMAIL PROTECTED] LIKE
'".$this->params['url']
['search_for']."%'");
}
else {
$scope = array();
}
$results = $this->Paginate("@Model", $scope);
$this->set("results", $results);
}
Replace @Model and @field with the name of the model and field you
want to search on.
On Aug 21, 1:10 pm, bitkidoku <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I am implementing a search form. But I want to make search results
> linkable like: "http://somehost/products/search/keyword" (keyword is
> the word that is being searched).
>
> What is the best practise to achieve this? And what if the user could
> search defining many parameters like title, content, ingredients etc.?
>
> I googled this but I couldn't find any meaningful results.
>
> Thank you very much for your answers.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---