Hi,
Sorry that I have not respondend! I have been very busy with work the
last week.
Ralph: Thank you for your detailed answer! I will defiantly look at
full text search later! Your exampled helped me understand the cake
controller better :)
Sohei: There is a missing ) in the first line after index.thtml
Below is my final search code. I have resused my index page that normal
displays all recipes.
form: (put in view or index)
<form action="<?php echo $html->url('/recipes/search'); ?>"
method="post">
<?php echo $html->input('Recipe/name'); ?>
<?php echo $html->submit('search');?>
</form>
controller:
function search() {
if(empty($this->data)) {
$this->render();
} else {
$conditions =array();
$search_term = $this->data['Recipe']['name'];
$conditions['Recipe']['name'] = "LIKE %{$search_term}%";
$recipes = $this->Recipe->findAll($conditions);
$this->set('recipes', $recipes);
$this->render("index");
}
}
Best regards.
Asbjørn Morell.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---