mvc

How to Cake PHP Search method

Cake PHP is a powerful MVC Framework that I am really enjoying however sometimes I don't have enough time to find the way that Cake PHP do something like a search using a OR clause =D So if you were looking for a direct instruction here you are:

<?php
function search() {

// $k is a POST with the keyword search...
$k = $this->data['Yourmodel']['search_key'];

$this->Yourmodel->recursive = 0;
// Displays all records if you didn't POST a keyword
if(empty($k)) {
$results = $this->paginate();
}
else {

Syndicate content