CAKEDC Search i want use search with and/or connectors
i want search by competence forexample $data['competences'] =java+oracle,sql then the method of the request competence must know java is first oracle is second and sql is third. favorite i want search by competence forexample $data['competences'] =java+oracle,sql then the method of the request competence must know java is first oracle is second and sql is third. in my query request i have this surprise: SELECT User.id, User.username, User.nom, User.prenom, User.email, User.password, User.created, User.modified FROM dcsearch.users AS User WHERE User.id in (SELECT CompetencesUser.user_id FROM dcsearch.competences_users AS CompetencesUser LEFT JOIN dcsearch.competences AS Competence ON (CompetencesUser.competence_id = Competence.id) WHERE Competence.competence LIKE '%First\%%') AND (Competence.competence LIKE '%Second\%%'))) OR (Competence.competence LIKE '%Third\%%'))) LIMIT 20 this is my model user.php im my $filterArgs 'competences' => array( 'type' => 'subquery', 'method' => 'findByCompetences', 'field' => 'User.id', 'connectorsAnd' => '+', 'connectorOr' => ',', 'before' => true, 'after' => true ); in my method findByCompetences public function findByCompetences($data = array()) { $this->CompetencesUser->Behaviors->attach('Containable', array( 'autoFields' => false ) ); $this->CompetencesUser->Behaviors->attach('Search.Searchable'); $data = array('competences' => 'First%+Second%, Third%'); $result = $this->CompetencesUser->parseCriteria($data); $expected = array(0 => array('OR' => array( array('AND' => array( array('Competence.competence LIKE' => '%First\%%'), array('Competence.competence LIKE' => '%Second\%%'), )), array('AND' => array( array('Competence.competence LIKE' => '%Third\%%') )), ))); $query = $this->CompetencesUser->getQuery('all', array( 'conditions' =>array( $expected, $result), 'fields' => array( 'user_id' ), 'contain' => array( 'Competence' ))); return $query; } i have this Error Invalid argument supplied for foreach() -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Result of function search is very large
Looks to me as if you could have done the same thing properly (not using session but PRG pattern) and with 3 lines of code using https://github.com/CakeDC/search mark Am Montag, 29. Juni 2015 10:30:50 UTC+2 schrieb Eb ook: > > Hello all, > > Result of function search is very large, It sometime is wrong. > > Can you help me to fix it. > > This is source this function. > > public function find(){ > $this->layout = 'listimage'; > $this->set('title_for_layout', __('Search Results', true)); > $this->Image->recursive = 0; > $search = $this->Session->read('Search'); > if(!empty($_POST['data'])){ > $this->Session->write('Search', $this->data); > $conditions = array(); > if($this->Session->read('Search.Image.region_id')){ > $q = $this->Session->read('Search.Image.region_id'); > $conditions['Image.region_id'] = $q; > } > if($this->Session->read('Search.Image.artist_id')){ > $q = $this->Session->read('Search.Image.artist_id'); > $conditions['Image.artist_id'] = $q; > } > if($this->Session->read('Search.Image.movement_id')){ > $q = $this->Session->read('Search.Image.movement_id'); > $conditions['Image.movement_id'] = $q; > } > if($this->Session->read('Search.Image.museum_id')){ > $q = $this->Session->read('Search.Image.museum_id'); > $conditions['Image.museum_id'] = $q; > } > if($this->Session->read('Search.Image.museum_id')){ > $q = $this->Session->read('Search.Image.museum_id'); > $conditions['Image.museum_id'] = $q; > } > if($this->Session->read('Search.Theme.Theme.0')){ > $q = $this->Session->read('Search.Theme.Theme.0'); > $this->Image->bindModel(array('hasOne' => > array('ImagesTheme')),false); > $conditions['ImagesTheme.theme_id']= $q; > } > if($this->Session->read('Search.Media.Media.0')){ > $q = $this->Session->read('Search.Media.Media.0'); > $this->Image->bindModel(array('hasOne' => > array('ImagesMedium')),false); > $conditions['ImagesMedium.media_id']= $q; > } > if($this->Session->read('Search.Image.start_year')){ > if($this->Session->read('Search.Image.end_year')){ > $q = $this->Session->read('Search.Image.start_year'); > $p = $this->Session->read('Search.Image.end_year'); > if($this->Session->read('Search.Image.BC_start')) > $conditions['Image.start_year <='] = $q; > else > $conditions['Image.start_year >='] = $q; > if($this->Session->read('Search.Image.BC_end')) > $conditions['Image.end_year >='] = $p; > else > $conditions['Image.end_year <='] = $p; > } > else { > $q = $this->Session->read('Search.Image.start_year'); > $conditions['Image.start_year ='] = $q; > } > } > if($this->Session->read('Search.Image.end_year')){ > if($this->Session->read('Search.Image.start_year')){ > $q = $this->Session->read('Search.Image.end_year'); > $p = $this->Session->read('Search.Image.start_year'); > if($this->Session->read('Search.Image.BC_start')) > $conditions['Image.start_year <='] = $p; > else > $conditions['Image.start_year >='] = $p; > if($this->Session->read('Search.Image.BC_end')) > $conditions
Result of function search is very large
Hello all, Result of function search is very large, It sometime is wrong. Can you help me to fix it. This is source this function. public function find(){ $this->layout = 'listimage'; $this->set('title_for_layout', __('Search Results', true)); $this->Image->recursive = 0; $search = $this->Session->read('Search'); if(!empty($_POST['data'])){ $this->Session->write('Search', $this->data); $conditions = array(); if($this->Session->read('Search.Image.region_id')){ $q = $this->Session->read('Search.Image.region_id'); $conditions['Image.region_id'] = $q; } if($this->Session->read('Search.Image.artist_id')){ $q = $this->Session->read('Search.Image.artist_id'); $conditions['Image.artist_id'] = $q; } if($this->Session->read('Search.Image.movement_id')){ $q = $this->Session->read('Search.Image.movement_id'); $conditions['Image.movement_id'] = $q; } if($this->Session->read('Search.Image.museum_id')){ $q = $this->Session->read('Search.Image.museum_id'); $conditions['Image.museum_id'] = $q; } if($this->Session->read('Search.Image.museum_id')){ $q = $this->Session->read('Search.Image.museum_id'); $conditions['Image.museum_id'] = $q; } if($this->Session->read('Search.Theme.Theme.0')){ $q = $this->Session->read('Search.Theme.Theme.0'); $this->Image->bindModel(array('hasOne' => array('ImagesTheme')),false); $conditions['ImagesTheme.theme_id']= $q; } if($this->Session->read('Search.Media.Media.0')){ $q = $this->Session->read('Search.Media.Media.0'); $this->Image->bindModel(array('hasOne' => array('ImagesMedium')),false); $conditions['ImagesMedium.media_id']= $q; } if($this->Session->read('Search.Image.start_year')){ if($this->Session->read('Search.Image.end_year')){ $q = $this->Session->read('Search.Image.start_year'); $p = $this->Session->read('Search.Image.end_year'); if($this->Session->read('Search.Image.BC_start')) $conditions['Image.start_year <='] = $q; else $conditions['Image.start_year >='] = $q; if($this->Session->read('Search.Image.BC_end')) $conditions['Image.end_year >='] = $p; else $conditions['Image.end_year <='] = $p; } else { $q = $this->Session->read('Search.Image.start_year'); $conditions['Image.start_year ='] = $q; } } if($this->Session->read('Search.Image.end_year')){ if($this->Session->read('Search.Image.start_year')){ $q = $this->Session->read('Search.Image.end_year'); $p = $this->Session->read('Search.Image.start_year'); if($this->Session->read('Search.Image.BC_start')) $conditions['Image.start_year <='] = $p; else $conditions['Image.start_year >='] = $p; if($this->Session->read('Search.Image.BC_end')) $conditions['Image.end_year >='] = $q; else $conditions['Image.end_year <='] = $q; } else { $q = $this->Session->read('Search.Image.end_year'); $conditions['Image.end_year ='] = $q; } } $search = $this->Session->read('Search.Image.q'); $newconditions = array(); if($search) { setlocale(LC_ALL, "en_US.utf8"); $search =
Re: cakephp search
You need to be more precise. Mark Am Donnerstag, 18. Juni 2015 10:17:17 UTC+2 schrieb SURYA PANDEY: > > *how to create search system using database in cake php.. plz suggest > me* > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
cakephp search
*how to create search system using database in cake php.. plz suggest me* -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Cakephp Search Plugin problem
I hope you can help me. I've done all steps like here "http://stackoverflow.com/questions/10590199/cakephp-basic-help-to-use-cakedc-search-plugin"; but the searcher doesn't anything. My project is about one User's List and I want to filter for the fields 'apellidos' or 'dni'. In my Controller I've the component declared and this: public function index() { $this->Prg->commonProcess(); $this->paginate = array( 'conditions' => $this->User->parseCriteria($this->passedArgs)); $this->set('users', $this->paginate()); $this->User->recursive = 0; $this->User->order = 'User.cod_cliente'; $this->User->conditions = 'User.nombre'; if($this->Session->read('Auth.User.group_id')==5) { //$this->set('categorias', $this->User->find('all',array('fields'=>array('group_id','cod_cliente','nombre','apellidos','dni','id'; }else { $this->User->conditions = array('User.cod_centro'=>$this->Session->read('Auth.User.cod_centro')); //$this->set('categorias', $this->User->find('all',array('fields'=>array('group_id','cod_cliente','nombre','apellidos','dni','id'),'conditions'=>array('User.cod_centro'=>$this->Session->read('Auth.User.cod_centro'); } $this->set('categorias', $this->Paginator->paginate()); $this->set('title_for_layout', __('Listado de usuarios')." - ".__('Administración')); } public $presetVars = array( array('field' => 'apellidos', 'type' => 'value'), array('field' => 'dni', 'type' => 'value'),); public $actsAs = array('Containable','Search.Searchable','Acl' => array('type' => 'requester')); public $filterArgs = array( array('name' => 'apellidos', 'type' => 'query', 'method' => 'filterApellidos'), array('name' => 'dni', 'type' => 'query', 'method' => 'filterDni'), ); and here are also the functions: public function filterApellidos($data, $field = null) { if (empty($data['apellidos'])) { return array(); } $apellidosField = '%' . $data['apellidos'] . '%'; return array( 'OR' => array( $this->alias . '.apellidos LIKE' => $apellidosField, )); } public function filterDni($data, $field = null) { if (empty($data['dni'])) { return array(); } $dniField = '%' . $data['dni'] . '%'; return array( 'OR' => array( $this->alias . '.dni LIKE' => $dniField, )); } // Built a list of search options (unless you have this list somewhere else) public function __construct($id = false, $table = null, $ds = null) { $this->statuses = array( '' => __('All', true), 0 => __('Bid', true), 1 => __('Cancelled', true), 2 => __('Approved', true), 3 => __('On Setup', true), 4 => __('Field', true), 5 => __('Closed', true), 6 => __('Other', true)); parent::__construct($id, $table, $ds); } Finally, in the View I have this: Form->create('Usuario', array( 'url' => array_merge(array('action' => 'index'), $this->params['pass']) )); echo $this->Form->input('apellidos', array('div' => false, 'empty' => true)); // empty creates blank option. echo $this->Form->input('dni', array('div' => false, 'empty' => true)); echo $this->Form->submit(__('Search', true), array('div' => false)); echo $this->Form->end(); ?> Could you tell me what I'm doing wrong, please? Thanks a lot!! Belén -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Search a foreign key - crud
Hi there, I'm new to web development and I've been studying cakephp and I have this situation where I want to know the best practice. Imagine a user creating a new Customer in the application, in the form he has to choose the customer's sales group, and this table has so many records, that's using a drop down list isn't a viable option. I was thinking in the user press a button, then open a modal window. This new window would have a grid, with search options (for filtering the data) and the user would choose one, and go back to the original form, bringing back the sales group selected by the user. What's the name of this technique, and is it a good option? How to do this in cakephp? Best regards -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: I need some help with CakeDC Search
Hola También hablo español. Cuentame exactamente que no funciona Saludos Enviado desde Gmail para Android en Moto G www.oxicode.io El jun. 1, 2015 4:57 AM, "euromark" escribió: > See http://sandbox3.dereuromark.de/sandbox/search-examples and the code > to it for example. > > > Am Sonntag, 31. Mai 2015 23:39:15 UTC+2 schrieb Jekill CR: >> >> >> *I need some help with CakeDC Search i configured the plugin with the >> instructions and nothing happens.* >> >> Only show the text of the search on the Web Browser search input. >> >> Please if someone have a working configuration and can share with me. >> >> thanks in advance! >> >> >> I need the most simple configuration nothing special. >> >> Sorry for my bad english. >> >> Jesus Castro - Costa Rica >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: I need some help with CakeDC Search
See http://sandbox3.dereuromark.de/sandbox/search-examples and the code to it for example. Am Sonntag, 31. Mai 2015 23:39:15 UTC+2 schrieb Jekill CR: > > > *I need some help with CakeDC Search i configured the plugin with the > instructions and nothing happens.* > > Only show the text of the search on the Web Browser search input. > > Please if someone have a working configuration and can share with me. > > thanks in advance! > > > I need the most simple configuration nothing special. > > Sorry for my bad english. > > Jesus Castro - Costa Rica > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
I need some help with CakeDC Search
*I need some help with CakeDC Search i configured the plugin with the instructions and nothing happens.* Only show the text of the search on the Web Browser search input. Please if someone have a working configuration and can share with me. thanks in advance! I need the most simple configuration nothing special. Sorry for my bad english. Jesus Castro - Costa Rica -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
thanks! this work perfect El viernes, 1 de agosto de 2014, 0:28:27 (UTC-4), Dakota escribió: > > Hi Jipson. > > I'm the one who migrated the search plugin to cake3. It has not been > updated to the New structure yet, so you need to use ./plugins/Search in > composer.json > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Dynamically set $filterArgs array (search plugin)
Hi all I am offering my customers the ability to create customer specific input fields and try to make them searchable with the search <https://github.com/CakeDC/search> plugin. I do not have any problem by creating static search condition in the $filterArgs array. In order to support the search for dynamically created input fields, my idea was to create the $filterArgs array in the CustomersController and then set it back to the model "Customer". I see that the array was set up with data but it seems like it is not taken into account (maybe loaded to late?) for the search once I pass it back to the model. So when I try to search a field, my custom search method findCustomerCustomFieldsBySelect() is not called. I would appreciate any kind of advice that makes it possible to search for those dynamic fields. Here is the gist with the relevant code: https://gist.github.com/doonot/8e83613b87fa47af0e61 Best Regards, Patrick -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Retrieving data from different models on passing different parameters in cakephp for advance search feature
Please provide more details on what you are trying to do! Guessing - Is this what you are asking about? You have a database with several tables and you want to search any field in any table for the parameters and return the id (or more info) of the rows in which the parameters are found. Enjoy, John On Friday, 3 April 2015 20:14:29 UTC+3, Apoorva Purohit wrote: > > I have made code with all data through different models but data based on > ids is not relevant. > What to do? > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Retrieving data from different models on passing different parameters in cakephp for advance search feature
I have made code with all data through different models but data based on ids is not relevant. What to do? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
Trust me, it is easier than what you are trying to do :) And only 1-2 lines of code and it works out of the box. Am Donnerstag, 19. Februar 2015 23:18:56 UTC+1 schrieb ajt: > > I had a look it and it looks difficult to use. > NOt sure if this is the best way to go and where is a complete example and > ability to go back to the page? > > This doesnt really help > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
I had a look it and it looks difficult to use. NOt sure if this is the best way to go and where is a complete example and ability to go back to the page? This doesnt really help -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
IMO you shouldnt reinvent the wheel (with design flaws in it), but re-use best practice approaches via plugin form that have been working for many years with ease: https://github.com/CakeDC/search is the de facto standard for easy filtering of your paginated data Mark Am Donnerstag, 19. Februar 2015 15:02:10 UTC+1 schrieb ajt: > > Hi, > > In cakephp I can add search filters and change the post vars into Get as > below. This works fine. My problem is how do go to another page found from > the list of searches and return to the same page? All search filters are > gone when i return as I am not storing them. > > eg I search for invoice 2 and get a list of searches. i click on link from > the search and view a page. I then want to return to the same page with > same page number for invoice 2? > > if (($this->request->is('post') ||$this->request->is('put'))&& > isset($this->request->data['filter'])) { > >$filter_url['controller'] = $this->request->params['controller']; >$filter_url['action'] = $this->request->params['action']; >$filter_url['page'] = 1; > // for each filter we will add a GET parameter for the generated > urlforeach($this->data['Filter'] as $name => $value){ >if($value){ >$filter_url[$name] = urlencode($value); >}} //Post params are now GET paramatersreturn > $this->redirect($filter_url); >}//isset > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
how can i return to page with same search filters
Hi, In cakephp I can add search filters and change the post vars into Get as below. This works fine. My problem is how do go to another page found from the list of searches and return to the same page? All search filters are gone when i return as I am not storing them. eg I search for invoice 2 and get a list of searches. i click on link from the search and view a page. I then want to return to the same page with same page number for invoice 2? if (($this->request->is('post') ||$this->request->is('put'))&& isset($this->request->data['filter'])) { $filter_url['controller'] = $this->request->params['controller']; $filter_url['action'] = $this->request->params['action']; $filter_url['page'] = 1; // for each filter we will add a GET parameter for the generated urlforeach($this->data['Filter'] as $name => $value){ if($value){ $filter_url[$name] = urlencode($value); }} //Post params are now GET paramatersreturn $this->redirect($filter_url); }//isset -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)
Hi John thanks for the reply. I'm not sure the purpose of the tables will help with a solution but here goes to be honest your description I think is right. The Customer table stores information about the actual business. e.g. Starbucks. So if my customer is Starbucks, this table will identify the customer for things like invoicing etc. CustomerAddress would store the addresses of the coffee shops. CustomerContact would store details of people who work for Starbucks. Using my first example, you could search for contacts at a particular address maybe for an email alert or something pertaining to that location. Maybe this way you would also work out engineer mileage to a location. Using my second example, you could search for a contact, for example making an appointment with them, then have their address details attached. Using this method, you could also assign a billing contact and use their details to send invoices etc... Hope this helps? On Monday, December 22, 2014 4:29:03 PM UTC, John Andersen wrote: > > Please describe your Customer and Contact with more words. What are they > in relation to each other? > > For example: > We register information on our customers. For each customer, we have > registered the employees that we use as contact when we wish to contact the > customer on specific subjects. > > The customer has a main office in one location and several other offices > in other locations. Thus we need also to know which of the contact people > are located in the specific location/office. > > When you try and describe the relation between customer and contacts and > other objects that may be of interest, then it will be easier for us to > help you :) > > Enjoy, John > > > On Sunday, 21 December 2014 01:33:43 UTC+2, Chris wrote: >> >> Hi all! >> >> I'm quite new to Cake and this is my first project. >> >> I'm working on a customer database. For larger business customers the >> relationships get a little complicated. I have 3 models, Customer, >> CustomerAddress and CustomerContact. A customer can have many addresses, >> and many contacts, but the contacts are also based at one address so an >> address has many contacts. >> >> The end result I'm trying to achieve is to be able to search the data >> both ways, e.g. >> Customer -> Address 1 -> Contact 1 >> Contact 2 >> Contact 3 >> >> >> Address 2 -> Contact 1 >> >> .... >> >> >> Or >> >> Customer -> Contact 1 -> Address >> Contact 2 -> Address >> >> >> I currently have it working as the first example, but found this >> problematic when I wanted to search the contacts, I have to search all the >> addresses too. If I search the contact I want to be able to get the address >> for that contact too, as in the second example. >> >> I'm not sure how to set this up, bit of help would be much appreciated to >> get me on the right track. >> >> TIA! >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)
Please describe your Customer and Contact with more words. What are they in relation to each other? For example: We register information on our customers. For each customer, we have registered the employees that we use as contact when we wish to contact the customer on specific subjects. The customer has a main office in one location and several other offices in other locations. Thus we need also to know which of the contact people are located in the specific location/office. When you try and describe the relation between customer and contacts and other objects that may be of interest, then it will be easier for us to help you :) Enjoy, John On Sunday, 21 December 2014 01:33:43 UTC+2, Chris wrote: > > Hi all! > > I'm quite new to Cake and this is my first project. > > I'm working on a customer database. For larger business customers the > relationships get a little complicated. I have 3 models, Customer, > CustomerAddress and CustomerContact. A customer can have many addresses, > and many contacts, but the contacts are also based at one address so an > address has many contacts. > > The end result I'm trying to achieve is to be able to search the data both > ways, e.g. > Customer -> Address 1 -> Contact 1 > Contact 2 > Contact 3 > > > Address 2 -> Contact 1 > > > > > Or > > Customer -> Contact 1 -> Address > Contact 2 -> Address > > > I currently have it working as the first example, but found this > problematic when I wanted to search the contacts, I have to search all the > addresses too. If I search the contact I want to be able to get the address > for that contact too, as in the second example. > > I'm not sure how to set this up, bit of help would be much appreciated to > get me on the right track. > > TIA! > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)
Hi all! I'm quite new to Cake and this is my first project. I'm working on a customer database. For larger business customers the relationships get a little complicated. I have 3 models, Customer, CustomerAddress and CustomerContact. A customer can have many addresses, and many contacts, but the contacts are also based at one address so an address has many contacts. The end result I'm trying to achieve is to be able to search the data both ways, e.g. Customer -> Address 1 -> Contact 1 Contact 2 Contact 3 Address 2 -> Contact 1 Or Customer -> Contact 1 -> Address Contact 2 -> Address I currently have it working as the first example, but found this problematic when I wanted to search the contacts, I have to search all the addresses too. If I search the contact I want to be able to get the address for that contact too, as in the second example. I'm not sure how to set this up, bit of help would be much appreciated to get me on the right track. TIA! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakeDC Search plugin find in hasmany
Solved, // @Model Order 'order_date' => array( 'type' => 'subquery', 'method' => 'orderDate', 'field' => 'User.id' ), public function orderDate($data = array()) { } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakeDC Search plugin find in hasmany
Hi, can someone show me how it looks correct $filterArgs settings if I need to search data in hasmany related model. example, User hasMany Orders. User model: public $filterArgs = array( 'id' => array( 'type' => 'value' ), 'name' => array( 'type' => 'like' ), 'company' => array( 'type' => 'like' ), 'email' => array( 'type' => 'like' ) // @Model Order 'order_date' => array( 'type' => 'like', 'model' => 'Order', 'modelField' => 'order_date' ), form field name is order_date.. Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Hi Dakota, Thank you very much. I installed the plugin using composer . But when I am trying to access it through the action I am getting an error Unknown method "parseCriteria"*Error: * An Internal Error Has Occurred. Is there any tutorial that I can refer to make it working on cakephp 3? Thank you very much for your time and the help. Regards, Jipson On Friday, 1 August 2014 05:28:27 UTC+1, Dakota wrote: > > Hi Jipson. > > I'm the one who migrated the search plugin to cake3. It has not been > updated to the New structure yet, so you need to use ./plugins/Search in > composer.json > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Hi Jipson. I'm the one who migrated the search plugin to cake3. It has not been updated to the New structure yet, so you need to use ./plugins/Search in composer.json -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Thank you Jose Lorenzo. On Thursday, 31 July 2014 13:03:57 UTC+1, José Lorenzo wrote: > > Not sure then, try contacting the plugin creator > > On Thursday, July 31, 2014 1:38:26 PM UTC+2, Jipson Thomas wrote: >> >> Hi Jose Lorenzo, >> Thank you for you post. Actually I stored the plugin files in the >> public_html/plugin folder manually. Then I modified the composer .json file >> and executed the dumpautoload command through terminal. Still I/ am getting >> the error. >> >> Regards, >> Jipson >> >> On Thursday, 31 July 2014 12:27:07 UTC+1, José Lorenzo wrote: >>> >>> I you did not install the plugin with composer, you will need to call >>> this command: >>> >>> composer dumpautoload >>> >>> On Thursday, July 31, 2014 11:48:43 AM UTC+2, Jipson Thomas wrote: >>>> >>>> Hi Euromark & Stephen >>>> >>>> Thank you very much. But on loading the plugin I am getting an error as >>>> following. >>>> *Error: * *Search.PrgComponent* could not be found. >>>> *Error: * Create the class *PrgComponent* below in file: >>>> /Applications/XAMPP/xamppfiles/htdocs/ >>>> prms.panovus.com/public_html/plugins/Search//Controller/Component/PrgComponent.php >>>> >>>> Actually I have the plugin files on place and I added the following >>>> line on bootstrap.php file to load plugin. >>>> Plugin::load('Search'); >>>> Also I updated the composer.jason file by adding the following >>>> "autoload": { >>>> "psr-4": { >>>> "App\\": "src", >>>> "App\\Test\\": "tests", >>>> "Search\\": "./plugins/Search/src", >>>> "Search\\Test\\": "./plugins/Search/tests" >>>> } >>>> }, >>>> and updated composer through commandline. by executing php >>>> composer.phar update and php composer.phar dumpautoload >>>> >>>> Would you please help me to find what is wrong in it? >>>> >>>> Regards, >>>> Jipson >>>> >>>> On Wednesday, 30 July 2014 18:12:47 UTC+1, euromark wrote: >>>>> >>>>> Look into the cake3 branch of >>>>> https://github.com/CakeDC/search/tree/3.0 >>>>> >>>>> >>>>> Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: >>>>>> >>>>>> Hi, >>>>>> Would you please let me know whether cakephp3 have an option for >>>>>> search filters on index view. >>>>>> Regards, >>>>>> Jipson >>>>>> >>>>> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Not sure then, try contacting the plugin creator On Thursday, July 31, 2014 1:38:26 PM UTC+2, Jipson Thomas wrote: > > Hi Jose Lorenzo, > Thank you for you post. Actually I stored the plugin files in the > public_html/plugin folder manually. Then I modified the composer .json file > and executed the dumpautoload command through terminal. Still I/ am getting > the error. > > Regards, > Jipson > > On Thursday, 31 July 2014 12:27:07 UTC+1, José Lorenzo wrote: >> >> I you did not install the plugin with composer, you will need to call >> this command: >> >> composer dumpautoload >> >> On Thursday, July 31, 2014 11:48:43 AM UTC+2, Jipson Thomas wrote: >>> >>> Hi Euromark & Stephen >>> >>> Thank you very much. But on loading the plugin I am getting an error as >>> following. >>> *Error: * *Search.PrgComponent* could not be found. >>> *Error: * Create the class *PrgComponent* below in file: >>> /Applications/XAMPP/xamppfiles/htdocs/ >>> prms.panovus.com/public_html/plugins/Search//Controller/Component/PrgComponent.php >>> >>> Actually I have the plugin files on place and I added the following line >>> on bootstrap.php file to load plugin. >>> Plugin::load('Search'); >>> Also I updated the composer.jason file by adding the following >>> "autoload": { >>> "psr-4": { >>> "App\\": "src", >>> "App\\Test\\": "tests", >>> "Search\\": "./plugins/Search/src", >>> "Search\\Test\\": "./plugins/Search/tests" >>> } >>> }, >>> and updated composer through commandline. by executing php >>> composer.phar update and php composer.phar dumpautoload >>> >>> Would you please help me to find what is wrong in it? >>> >>> Regards, >>> Jipson >>> >>> On Wednesday, 30 July 2014 18:12:47 UTC+1, euromark wrote: >>>> >>>> Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 >>>> >>>> >>>> Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: >>>>> >>>>> Hi, >>>>> Would you please let me know whether cakephp3 have an option for >>>>> search filters on index view. >>>>> Regards, >>>>> Jipson >>>>> >>>> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Hi Jose Lorenzo, Thank you for you post. Actually I stored the plugin files in the public_html/plugin folder manually. Then I modified the composer .json file and executed the dumpautoload command through terminal. Still I/ am getting the error. Regards, Jipson On Thursday, 31 July 2014 12:27:07 UTC+1, José Lorenzo wrote: > > I you did not install the plugin with composer, you will need to call this > command: > > composer dumpautoload > > On Thursday, July 31, 2014 11:48:43 AM UTC+2, Jipson Thomas wrote: >> >> Hi Euromark & Stephen >> >> Thank you very much. But on loading the plugin I am getting an error as >> following. >> *Error: * *Search.PrgComponent* could not be found. >> *Error: * Create the class *PrgComponent* below in file: >> /Applications/XAMPP/xamppfiles/htdocs/ >> prms.panovus.com/public_html/plugins/Search//Controller/Component/PrgComponent.php >> >> Actually I have the plugin files on place and I added the following line >> on bootstrap.php file to load plugin. >> Plugin::load('Search'); >> Also I updated the composer.jason file by adding the following >> "autoload": { >> "psr-4": { >> "App\\": "src", >> "App\\Test\\": "tests", >> "Search\\": "./plugins/Search/src", >> "Search\\Test\\": "./plugins/Search/tests" >> } >> }, >> and updated composer through commandline. by executing php composer.phar >> update and php composer.phar dumpautoload >> >> Would you please help me to find what is wrong in it? >> >> Regards, >> Jipson >> >> On Wednesday, 30 July 2014 18:12:47 UTC+1, euromark wrote: >>> >>> Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 >>> >>> >>> Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: >>>> >>>> Hi, >>>> Would you please let me know whether cakephp3 have an option for >>>> search filters on index view. >>>> Regards, >>>> Jipson >>>> >>> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
I you did not install the plugin with composer, you will need to call this command: composer dumpautoload On Thursday, July 31, 2014 11:48:43 AM UTC+2, Jipson Thomas wrote: > > Hi Euromark & Stephen > > Thank you very much. But on loading the plugin I am getting an error as > following. > *Error: * *Search.PrgComponent* could not be found. > *Error: * Create the class *PrgComponent* below in file: > /Applications/XAMPP/xamppfiles/htdocs/ > prms.panovus.com/public_html/plugins/Search//Controller/Component/PrgComponent.php > > Actually I have the plugin files on place and I added the following line > on bootstrap.php file to load plugin. > Plugin::load('Search'); > Also I updated the composer.jason file by adding the following > "autoload": { > "psr-4": { > "App\\": "src", > "App\\Test\\": "tests", > "Search\\": "./plugins/Search/src", > "Search\\Test\\": "./plugins/Search/tests" > } > }, > and updated composer through commandline. by executing php composer.phar > update and php composer.phar dumpautoload > > Would you please help me to find what is wrong in it? > > Regards, > Jipson > > On Wednesday, 30 July 2014 18:12:47 UTC+1, euromark wrote: >> >> Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 >> >> >> Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: >>> >>> Hi, >>> Would you please let me know whether cakephp3 have an option for search >>> filters on index view. >>> Regards, >>> Jipson >>> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Hi Euromark & Stephen Thank you very much. But on loading the plugin I am getting an error as following. *Error: * *Search.PrgComponent* could not be found. *Error: * Create the class *PrgComponent* below in file: /Applications/XAMPP/xamppfiles/htdocs/prms.panovus.com/public_html/plugins/Search//Controller/Component/PrgComponent.php Actually I have the plugin files on place and I added the following line on bootstrap.php file to load plugin. Plugin::load('Search'); Also I updated the composer.jason file by adding the following "autoload": { "psr-4": { "App\\": "src", "App\\Test\\": "tests", "Search\\": "./plugins/Search/src", "Search\\Test\\": "./plugins/Search/tests" } }, and updated composer through commandline. by executing php composer.phar update and php composer.phar dumpautoload Would you please help me to find what is wrong in it? Regards, Jipson On Wednesday, 30 July 2014 18:12:47 UTC+1, euromark wrote: > > Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 > > > Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: >> >> Hi, >> Would you please let me know whether cakephp3 have an option for search >> filters on index view. >> Regards, >> Jipson >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
My mistake, I overlooked this was for CakePHP3 (it has been a long day), please disregard my comment. On 30 July 2014 18:12, euromark wrote: > Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 > > > Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: > >> Hi, >> Would you please let me know whether cakephp3 have an option for search >> filters on index view. >> Regards, >> Jipson >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
Look into the cake3 branch of https://github.com/CakeDC/search/tree/3.0 Am Mittwoch, 30. Juli 2014 17:34:01 UTC+2 schrieb Jipson Thomas: > > Hi, > Would you please let me know whether cakephp3 have an option for search > filters on index view. > Regards, > Jipson > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Index View with search filter option on Cake PHP 3
You can do this using queries and form submit or ajax, a very simple example in theory would be to have a filter say username, then on submit if $this->request->data['Model']['username'] is not null then pass a LIKE condition to the paginate query. It's simple practice but something you will have to attempt yourself and then ask more specific questions if you get stuck, not something that is included as a full feature by default. HTH, Stephen On 30 July 2014 16:34, Jipson Thomas wrote: > Hi, > Would you please let me know whether cakephp3 have an option for search > filters on index view. > Regards, > Jipson > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Index View with search filter option on Cake PHP 3
Hi, Would you please let me know whether cakephp3 have an option for search filters on index view. Regards, Jipson -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Search Plugin Problem (?)
What is your db table look like? Could you post the SQL here? On Thu, May 22, 2014 at 9:51 PM, 山本広樹 wrote: > > Model- > > App::uses('AppModel','Model'); > > class DetailData extends AppModel{ > > public $actsAs = array('Search.Searchable'); > public $filterArgs = array('school_name'=> array('type' => 'value'),); > > > } > > > Controller- > > App::uses('AppController', 'Controller'); > > class DetailDatasController extends AppController { > > public $components = array('Paginator','Search.Prg'); > > public function beforeFilter(){ > > parent::beforeFilter(); > > } > > public function index(){ > > $this->Prg->commonProcess(); > $this->paginate = array( > 'DetailData' => > array( > 'conditions' => array( > $this->DetailData->parseCriteria($this->passedArgs) > ) > )); > > $this->DetailData->recursive = 0; > $this->set('detaildatas', $this->Paginator->paginate()); > > } > > } > > View--- > > > > > > > > > > > > > > > > > > > > > > > > > echo $this->Paginator->counter(array('format' => '全%count%件' )); > echo $this->Paginator->counter(array('format' => > '{:page}/{:pages}ページを表示')); > > echo $this->Paginator->first('最初のページへ ', array(), null, > array('class'=> 'first disabled')); > echo $this->Paginator->prev(' < 前へ',array(), null, array('class' => > 'prev disabled')); > echo $this->Paginator->numbers(array('separator' => ' ')); > echo $this->Paginator->next(' 次へ >', array(), null, array('class'=> > 'next disabled')); > echo $this->Paginator->last(' 最後のページへ', array(), null, array('class'=> > 'next disabled')); > ?> > > > element('searchForm'); ?> > > > > > > > Error- > Database Error > *Error: *SQLSTATE[42000]: Syntax error or access violation: 1064 You have > an error in your SQL syntax; check the manual that corresponds to your > MySQL server version for the right syntax to use near 'parseCriteria' at > line 1 > > > It doesn't work. Plugin is Cake DC/Search. > > Do you have any idea to solve this problem? > > > > Hiroki Yamamoto > > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Search Plugin Problem (?)
Model- array('type' => 'value'),); } Controller- Prg->commonProcess(); $this->paginate = array( 'DetailData' => array( 'conditions' => array( $this->DetailData->parseCriteria($this->passedArgs) ) )); $this->DetailData->recursive = 0; $this->set('detaildatas', $this->Paginator->paginate()); } } View--- Paginator->counter(array('format' => '全%count%件' )); echo $this->Paginator->counter(array('format' => '{:page}/{:pages}ページを表示')); echo $this->Paginator->first('最初のページへ ', array(), null, array('class'=> 'first disabled')); echo $this->Paginator->prev(' < 前へ',array(), null, array('class' => 'prev disabled')); echo $this->Paginator->numbers(array('separator' => ' ')); echo $this->Paginator->next(' 次へ >', array(), null, array('class'=> 'next disabled')); echo $this->Paginator->last(' 最後のページへ', array(), null, array('class'=> 'next disabled')); ?> element('searchForm'); ?> Error----- Database Error *Error: *SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parseCriteria' at line 1 It doesn't work. Plugin is Cake DC/Search. Do you have any idea to solve this problem? Hiroki Yamamoto -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to integrate Apache Lucene search engine with cakephp 2.x
I would strongly suggest using ElasticSearch. It is the easiest way of integrating lucene in any project. On Tuesday, April 22, 2014 6:11:19 AM UTC+2, Pawan Kumar wrote: > > I want to integrate *Apache Lucene Search engine* with *cakephp*, here > is the link for Apache Lucene serach engine http://lucene.apache.org/core/ > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
How to integrate Apache Lucene search engine with cakephp 2.x
I want to integrate *Apache Lucene Search engine* with *cakephp*, here is the link for Apache Lucene serach engine http://lucene.apache.org/core/ -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakeDC Search $filterArgs
Can someone explain to me the filterArgs property? Is it like a pre-search filter? Am I restricting what users can search for? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC Search plugin for CakePhp 2.0, multiple models
Is your version different than the CakeDC version? The readme looks exactly the same. CoderDJ412 On Friday, June 15, 2012 4:08:11 AM UTC-4, euromark wrote: > > try this one: > https://github.com/dereuromark/search<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fdereuromark%2Fsearch&sa=D&sntz=1&usg=AFQjCNFXx3wLOL6ZnMqqbpOpqx_xLzlvUA> > > > it can handle multiple fields across models for a like term etc > > 'field' => array('Primary.field', 'Secondary.other_field') > > > Am Freitag, 15. Juni 2012 00:06:03 UTC+2 schrieb Bob Bowen: >> >> Is there any way to make this work? As I understand it you have to >> enable Search.Searchable in the $actsAs, and define $filterArgs for each >> Model, then add Search.Prg to $components and define $presetVars in the >> Controller. >> >> Then in your .ctp file you put something like this: >> >> echo $this->Form->create('MyModel', array('url' => >> array_merge(array('action' => 'find'), $this->params['pass']))); >> echo $this->Form->input('search', array('div' => false)); >> echo $this->Form->submit(__('Search', true), array('div' => false)); >> echo $this->Form->end(); >> >> But this allows you to search in one Model at a time. Is there any way to >> define a search form with one search field and have it look in various >> fields within various Models? >> >> Thanks >> Bob >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC Search plugin for CakePhp 2.0, multiple models
I got the same error and I was using related tables. On Saturday, June 16, 2012 7:13:03 PM UTC-4, Bob Bowen wrote: > > Hi and thanks for the reply. > > Yea, I had seen this plugin, it's a fork of the CakeDC plugin. And I see > in the docs that you can do something like this: > > class Article extends AppModel { > public $filterArgs = array( > 'enhanced_search' => array('type' => 'like', 'field' => > array('Article.name', 'OtherModel.name')) > } > } > > But what is not explained is, how do I get the plugin to actually search > within the 'OtherModel' Model? I ask because later in the Controller you > have: > > class ArticlesController extends AppController { > public $components = array('Search.Prg'); > > public $presetVars = true; // using the model configuration > > public function find() { > $this->Prg->commonProcess(); > $this->paginate['conditions'] = $this->*Article* > ->parseCriteria($this->passedArgs); > $this->set('articles', $this->paginate()); > } > } > > And in the .ctp you have: > > echo $this->Form->create('*Article*', array( > 'url' => array_merge(array('action' => 'find'), $this->params['pass']) > )); > > As you can see, the Article Model is always referenced. So if I want to > search for a field from another model, like the 'OtherModel.name' example > above, it crashes, saying: > > Column not found: 1054 Unknown column ' OtherModel.name ' in 'where clause' > > The SQL is more or less: > > SELECT `Article`.`id`, ... FROM `articles` WHERE ((`Article`.`name` LIKE > '%foo%') OR (`OtherModel`.`name` LIKE '%foo%')) > > Obviously OtherModel.name is not going to be found in Article. > > What I need to do is have a general Search box that searches in 4-5 > different Models. There is no relation between those Models. So I am not > sure which Model to put the filterArgs array, which Controller to put the > presetVars array and find() function, and how to call it all in my .ctp so > that it can return results from all 5 of these Models, not just one. > > Can this plugin do it? > > Many thanks! > > On Friday, June 15, 2012 10:08:11 AM UTC+2, euromark wrote: >> >> try this one: >> https://github.com/dereuromark/search<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fdereuromark%2Fsearch&sa=D&sntz=1&usg=AFQjCNFXx3wLOL6ZnMqqbpOpqx_xLzlvUA> >> >> >> it can handle multiple fields across models for a like term etc >> >> 'field' => array('Primary.field', 'Secondary.other_field') >> >> >> Am Freitag, 15. Juni 2012 00:06:03 UTC+2 schrieb Bob Bowen: >>> >>> Is there any way to make this work? As I understand it you have to >>> enable Search.Searchable in the $actsAs, and define $filterArgs for each >>> Model, then add Search.Prg to $components and define $presetVars in the >>> Controller. >>> >>> Then in your .ctp file you put something like this: >>> >>> echo $this->Form->create('MyModel', array('url' => >>> array_merge(array('action' => 'find'), $this->params['pass']))); >>> echo $this->Form->input('search', array('div' => false)); >>> echo $this->Form->submit(__('Search', true), array('div' => false)); >>> echo $this->Form->end(); >>> >>> But this allows you to search in one Model at a time. Is there any way >>> to define a search form with one search field and have it look in various >>> fields within various Models? >>> >>> Thanks >>> Bob >>> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: What code to put for using the CakeDC search plugin?
Finally got it working!!! It must have been my version of Cake or something but we're in there! Finally! On Tuesday, December 13, 2011 5:28:16 PM UTC-5, Daniel wrote: > > I want to do a search on fields in two tables, body and title fields > (in posts table) and body field (in comments table). I have installed > the CakeDC search plugin. In the models I have added the 'Searchable' > code: > > var $actsAs = array('Containable', 'Searchable'); > > I am trying to follow the page on the CakeDC site: > http://cakedc.com/eng/downloads/view/cakephp_search_plugin > > ... but I don't understand the example. > > What should I put next in the model? > > Thanks. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: What code to put for using the CakeDC search plugin?
Yes, I followed the readme. I've added the plugin, the behavior and component. I am stuck on the filterArgs properties. Here's my model code: App::uses('Security', 'Utility'); App::uses('SearchableBehavior', 'Search.Model/Behavior'); App::uses('AppModel', 'Model'); class Venue extends AppModel { public $name = 'Venue'; public $actAs = array( 'Containable', 'Search.Searchable'); public $filterArgs = array( 'name' => array('type' => 'like') ); //Controller code: public function find(){ $this->Prg->commonProcess(); $this->Paginator->settings['conditions'] = $this->Venue->parseCriteria($this->Prg->parsedParams()); $this->set('venues', $this->Paginator->paginate()); } //View code echo $this->Form->create('Venue', array( 'url' => array_merge(array('action' => 'find'), $this->params['pass']) )); echo $this->Form->input('name', array('div' => false)); echo $this->Form->submit(__('Search'), array('div' => false)); echo $this->Form->end(); Error recieved: *Notice* (8): Array to string conversion [*CORE\Cake\Model\Datasource\DboSource.php*, line *460*] *Error: *SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parseCriteria' at line 1 *SQL Query: *parseCriteria Onn Friday, November 15, 2013 6:36:31 AM UTC-5, euromark wrote: Did you follow the readme? You need to be more specific when you ask a question - ideally including > what you already tried so far. > > Am Freitag, 15. November 2013 05:32:13 UTC+1 schrieb Charles Blackwell: >> >> Do you need a create a search function of some sort to get it to work? I >> am stuck on how to get it working. >> >> On Tuesday, December 13, 2011 6:51:30 PM UTC-5, Daniel wrote: >>> >>> OK, forget it, I got a basic search up and running now. >>> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
CakeDC Search: Filter Method
Do I need to add a filter method for the search plugin to work? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: What code to put for using the CakeDC search plugin?
Did you follow the readme? You need to be more specific when you ask a question - ideally including what you already tried so far. Am Freitag, 15. November 2013 05:32:13 UTC+1 schrieb Charles Blackwell: > > Do you need a create a search function of some sort to get it to work? I > am stuck on how to get it working. > > On Tuesday, December 13, 2011 6:51:30 PM UTC-5, Daniel wrote: >> >> OK, forget it, I got a basic search up and running now. >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: What code to put for using the CakeDC search plugin?
Do you need a create a search function of some sort to get it to work? I am stuck on how to get it working. On Tuesday, December 13, 2011 6:51:30 PM UTC-5, Daniel wrote: > > OK, forget it, I got a basic search up and running now. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CAKEPHP can not bake a search in view ?
See https://github.com/CakeDC/search for solid search functionality Doesn't need to be baked (even though it can easily be added to your custom bake templates), you can just add it afterwards. Am Donnerstag, 24. Oktober 2013 11:12:40 UTC+2 schrieb Trần Michael: > > Hi Expert, > > Why new version, we can not bake a view that have search module ? > > it's dufficult to make it ? . I hope new version CAKEPHP can have it. > > > Thks your time. > > I am a newbie. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CAKEPHP can not bake a search in view ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Michael, other as index, add, edit a search is more complex. I have been building search methods and forms since I started with cake and in most cases they get quite complicated very soon, because in most cases your users not only want to perform simple searches e.g. for the name of your object, but more often they want to search for related models. And as soon as you have a HABTM relation things can get quite nasty. What I do in real life: I create a view by combining the index and the edit view. the edit gives you a basic template for your search form and the index the basic template for the results already including pagination. In the controller you build an extra method. If you are a newbie start with a very simple search e.g. just for the name or id and then progress to more advanced search scenarios. Also have a look here: http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html Good luck! Anja Am 24.10.2013 11:12, schrieb Trần Michael: > Hi Expert, > > Why new version, we can not bake a view that have search module ? > > it's dufficult to make it ? . I hope new version CAKEPHP can have it. > > > Thks your time. > > I am a newbie. > > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJqS3IACgkQbOdiIJzHNKGLIQCgiRb4GkXw1xVMHlbCDXi3kOSn PMUAn0EHW+YhXaQXRh4q5kdvGfk7Ap0v =DBd5 -END PGP SIGNATURE- -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
CAKEPHP can not bake a search in view ?
Hi Expert, Why new version, we can not bake a view that have search module ? it's dufficult to make it ? . I hope new version CAKEPHP can have it. Thks your time. I am a newbie. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
I know this is thread is a little old, but I'm having the same problem and just can't seem to resolve it. The query being generated is missing conditions for reasons I can't figure out: SELECT `Book`.`book_id`, `Book`.`isbn13`, `Book`.`isbn10`, `Book`.`series`, `Book`.`format`, `Book`.`title`, `Book`.`title_prefix`, `Book`.`title_without_prefix`, `Book`.`subtitle`, `Book`.`language`, `Book`.`pages`, `Book`.`basic`, `Book`.`audience`, `Book`.`age_from`, `Book`.`age_to`, `Book`.`grade_from`, `Book`.`grade_to`, `Book`.`main_desc`, `Book`.`bio_note`, `Book`.`review_quote`, `Book`.`imprint`, `Book`.`publisher`, `Book`.`pub_status`, `Book`.`pub_date`, `Book`.`height`, `Book`.`width`, `Book`.`url`, `Book`.`extras` FROM `titles`.`books` AS `Book` WHERE 1 = 1LIMIT 20 The weird thing is that when I debug the search action line: debug($this->paginate['conditions'] = $this->Book->parseCriteria($this->passedArgs)); I do get an array with the condition: array( 'Book.title LIKE' => '%sweet%' ) I'm not sure where this condition goes missing! Thanks for anything you can help with. On Monday, 15 April 2013 19:14:46 UTC-4, cricket wrote: > > What does the resulting query look like? Does it include the condition > with the submitted name? > > > On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf > > > wrote: > >> Actually i already Google several search plugin for CakePHP but most of >> CakePHP user recommended search plugin from CakeDC. So, i download the >> plugin from https://github.com/dereuromark/search and load the plugin >> with code: CakePlugin::load('Search'); in bootstrap.php >> >> Then i implement the code for my file controller: >> >> public $components = array('Search.Prg'); >> public $presetVars = true; // using the model configuration >> public function find() { >> $this->Prg->commonProcess(); >> $this->paginate['conditions'] = >> $this->Patient->parseCriteria($this->passedArgs); >> $this->set('patients', $this->paginate()); >> } >> * >> * >> * >> * >> For the model, i put this code: >> >> public $actsAs = array('Search.Searchable'); >> public $filterArgs = array( >> array('name' => 'name', 'type' => 'query', 'method' => >> 'filterName'), >> ); >> >> public function filterName($data, $field = null) { >> if (empty($data['name'])) { >> return array(); >> } >> $nameField = '%' . $data['name'] . '%'; >> return array( >> 'OR' => array( >> $this->alias . '.name LIKE' => $nameField, >> )); >> } >> >> For the view (find.ctp), i put this code for the form: (others code are >> exactly same as view/index.ctp) >> >> > echo $this->Form->create('Patient', array( >> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >> )); >> echo $this->Form->input('name', array('div' => false)); >> echo $this->Form->submit(__('Search'), array('div' => false)); >> echo $this->Form->end(); >> ?> >> >> >> What i try to achieve is the search plugin will do searching for "name" >> from table patients. However, this code seems not working but in the URL, >> once i do searching for example i "John" as the search term, the URL bar >> show as patients/find/name:john but the list of record are not showing john >> record only but still show all records instead of john only. >> >> As for the information i use CakePHP ver: 2.3.1. Is it any problem with >> the codes or any depreciate attributes in the coding? Sorry if this >> question repeated in this group but i still unable to find any solution. >> Most of the user claimed that it is easy to use this plugin but i'm still >> new in CakePHP. Hope someone can help me. >> >> Thanks :) >> >> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+u...@googlegroups.com . >> To post to this group, send email to cake...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/cake-php?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
On Monday, 15 April 2013 19:09:01 UTC-4, cricket wrote: > > You can get rid of that notice by declaring the $paginate array as a class > var: > > public $paginate = array(); > public $components = ... > > > On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf > > > wrote: > >> I've made the amendment to the code but still the result are same. no >> search result produced and i notice there is warning on top of the page say: >> >> Notice (8): Indirect modification of overloaded property >> PatientsController::$paginate has no effect >> [APP\Controller\PatientsController.php, line 14] >> >> where the code that caused the notice to appear is: >> >> $this->paginate['conditions'] = >> $this->Patient->parseCriteria($this->passedArgs); >> >> is there any other codes that i've missed? Thanks a lot :) >> >> >> On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote: >>> >>> I would use string array keys: >>> >>> public $filterArgs = array( >>> 'name' => array('type' => 'query', 'method' => 'filterName'), >>> ); >>> >>> but both ways should work >>> >>> PS: echo $this->Form->create('Patient') is enough, as it automatically >>> posts to itself >>> >>> >>> >>> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf: >>>> >>>> Actually i already Google several search plugin for CakePHP but most of >>>> CakePHP user recommended search plugin from CakeDC. So, i download the >>>> plugin from >>>> https://github.com/**dereuromark/search<https://github.com/dereuromark/search> >>>> and >>>> load the plugin with code: CakePlugin::load('**Search'); in >>>> bootstrap.php >>>> >>>> Then i implement the code for my file controller: >>>> >>>> public $components = array('Search.Prg'); >>>> public $presetVars = true; // using the model configuration >>>> public function find() { >>>> $this->Prg->commonProcess(); >>>> $this->paginate['conditions'] = $this->Patient->parseCriteria(* >>>> *$this->passedArgs); >>>> $this->set('patients', $this->paginate()); >>>> } >>>> * >>>> * >>>> * >>>> * >>>> For the model, i put this code: >>>> >>>> public $actsAs = array('Search.Searchable'); >>>> public $filterArgs = array( >>>> array('name' => 'name', 'type' => 'query', 'method' => >>>> 'filterName'), >>>> ); >>>> >>>> public function filterName($data, $field = null) { >>>> if (empty($data['name'])) { >>>> return array(); >>>> } >>>> $nameField = '%' . $data['name'] . '%'; >>>> return array( >>>> 'OR' => array( >>>> $this->alias . '.name LIKE' => $nameField, >>>> )); >>>> } >>>> >>>> For the view (find.ctp), i put this code for the form: (others code are >>>> exactly same as view/index.ctp) >>>> >>>> >>> echo $this->Form->create('Patient', array( >>>> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >>>> )); >>>> echo $this->Form->input('name', array('div' => false)); >>>> echo $this->Form->submit(__('**Search'), array('div' => false)); >>>> echo $this->Form->end(); >>>> ?> >>>> >>>> >>>> What i try to achieve is the search plugin will do searching for "name" >>>> from table patients. However, this code seems not working but in the URL, >>>> once i do searching for example i "John" as the search term, the URL bar >>>> show as patients/find/name:john but the list of record are not showing >>>> john >>>> record only but still s
Simple search working but not in an intended way
Hi guys, I would like to ask for guidance :) I just started using cakephp yesterday. So I'm still on the learning process. So yeah, I have this search action. It's working (at least it's what I think). But when I press the search button, no matter what I input, the action outputs all contents from the database even if I placed a condition. Please refer to my code below. Controller public function search() { $keyword = '%'.$this->params->query['keyword'].'%'; $cond=array('OR'=>array('Job.id LIKE' => $keyword,'Job.product LIKE' => $keyword) ); if($this->request->is('post')){ $list = $this->Job->find('all',array('conditions'=>$cond)); $this->set('results', $list); } } View Search Form->create('Job', array('url' => array('action' => 'search'))); ?> Form->input('keyword', array('style' => 'width: 250px;', 'label' => false)); ?> Form->end('Search'); ?> Id Product Actions Html->link($job['Job']['id'], array('action' => 'view', $job['Job']['id'])); ?> Html->link('Edit', array('action' => 'edit', $job['Job']['id'])); ?> Form->postLink('Delete', array('action' => 'delete', $job['Job']['id']), array('confirm'=>'Are you sure you want to delete this post?')); ?> -- View this message in context: http://cakephp.1045679.n5.nabble.com/Simple-search-working-but-not-in-an-intended-way-tp5716478.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
i18n Search for string in multiple translations
Hi there, Im trying to set up a search function for a multilingual website. I'm using cake's (2.2) translation behavior and my translated fields are saved in a separate table (for example: I18n__titleTranslation) Now i would like to search these records and their translations but the only way I seem to be able to do that is by looping through all the site languages (6 in my case) and setting $this->Model->locale = for every language before I do a find. To me this comes over as a bit expensive and in the process actually can result in duplicate results (keyword 'test' can be found on multiple translations). Does anyone have an idea of how to tackle this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC search plugin issue
'subject' => 'subject' where did you get that from? sure not the documentation :) it should read: public $filterArgs = array( 'subject' => array('type' => 'query', 'method' => 'filterSubject'), ); Am Montag, 22. Juli 2013 06:38:53 UTC+2 schrieb Asyraf Wahi Anuar: > > Hi, > > CakePHP version: 2.3.6 > > i try to implement the CakeDC search function by add this code to my > controller: > > class QuestionsController extends AppController { > public $paginate = array(); //create array for record page > public $components = array('Search.Prg'); > public $presetVars = true; // using the model configuration > public function find() { > $this->Prg->commonProcess(); > $this->paginate['conditions'] = > $this->Question->parseCriteria($this->passedArgs); > $this->set('questions', $this->paginate()); > } > > then i add this code to model: > > public $actsAs = array('Search.Searchable'); > public $filterArgs = array( > array('subject' => 'subject', 'type' => 'query', 'method' => > 'filterSubject'), > ); > public function filterSubject($data, $field = null) { > if (empty($data['subject'])) { > return array(); > } > $subjectField = '%' . $data['subject'] . '%'; > return array( > 'OR' => array( > $this->alias . '.subject LIKE' => $subjectField, > )); > } > > and the last part is to add the form: > > echo $this->Form->create('Question'); > echo $this->Form->input('subject', array('div' => false)); > echo $this->Form->submit(__('Search'), array('div' => false)); > echo $this->Form->end(); > ?> > > But this scrip does not work. Is it any problem with the code? FYI, i have > table name "questions" and inside the table, i have several field such as > id, subject, code, etc... so what i try to do is to do searching based on > the subject. Anybody can assist me? > > Thank you :) > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
CakeDC search plugin issue
Hi, CakePHP version: 2.3.6 i try to implement the CakeDC search function by add this code to my controller: class QuestionsController extends AppController { public $paginate = array(); //create array for record page public $components = array('Search.Prg'); public $presetVars = true; // using the model configuration public function find() { $this->Prg->commonProcess(); $this->paginate['conditions'] = $this->Question->parseCriteria($this->passedArgs); $this->set('questions', $this->paginate()); } then i add this code to model: public $actsAs = array('Search.Searchable'); public $filterArgs = array( array('subject' => 'subject', 'type' => 'query', 'method' => 'filterSubject'), ); public function filterSubject($data, $field = null) { if (empty($data['subject'])) { return array(); } $subjectField = '%' . $data['subject'] . '%'; return array( 'OR' => array( $this->alias . '.subject LIKE' => $subjectField, )); } and the last part is to add the form: Form->create('Question'); echo $this->Form->input('subject', array('div' => false)); echo $this->Form->submit(__('Search'), array('div' => false)); echo $this->Form->end(); ?> But this scrip does not work. Is it any problem with the code? FYI, i have table name "questions" and inside the table, i have several field such as id, subject, code, etc... so what i try to do is to do searching based on the subject. Anybody can assist me? Thank you :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: One page with Search/Edit/Add and Delete Buttons
Im assuming the if() is in your controller not a view file?? Here is a snip of a view for one of my older apps I am working on updating. I use postLinks like this 0){ foreach ($divisions AS $row){ ?> Form->postLink('Edit', array('action' => 'edit', $row['Divisions']['division_id']), array('class'=>'button blue'));?> Form->postLink('Delete', array('action' => 'delete', $row['Divisions']['division_id']), array('class'=>'button red', 'confirm' => 'Are you sure?'));?> No Divisions Configured The delete button would then post to the delete() function in the controller etc Eric On Thursday, June 20, 2013 8:04:03 AM UTC-4, Mahdi Miad wrote: > > Hi all, > I am new in CakePHP, I developed some applications before and now I need > to create my application same as before but with cakePHP, so what I need is > one page with add,edit,search and delete button, if I click on search > button I need to call search method and edit button with edit method and so > on. here is some of my code. > Thanks for your time. > > > > if (isset($this->request->data['Search'])) { > // call Search method with EmployeeID as a primery key > > } else if (isset($this->request->data['Add'])) { > // call Add method > > }else if (isset($this->request->data['Edit'])) { > // call Edit method > > }else if (isset($this->request->data['Delete'])) { > // call Delete method > } > > > > echo $this->Form->create('myModel' ); > > echo $this->Form->input('EmployeeID'); > echo $this->Form->input('First Name' ); > echo $this->Form->input('Last Name'); > echo $this->Form->input('Departement'); > echo $this->Form->input('Address'); > > > echo $this->Form->submit('Search' , array('name' =>'Search' )); > echo $this->Form->submit('Add' , array('name' =>'Add')); > echo $this->Form->submit('Edit' , array('name' =>'Edit')); > echo $this->Form->submit('Delete', array('name' =>'Delete' )); > > > echo $this->form->end(); > ?> > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
One page with Search/Edit/Add and Delete Buttons
Hi all, I am new in CakePHP, I developed some applications before and now I need to create my application same as before but with cakePHP, so what I need is one page with add,edit,search and delete button, if I click on search button I need to call search method and edit button with edit method and so on. here is some of my code. Thanks for your time. request->data['Search'])) { // call Search method with EmployeeID as a primery key } else if (isset($this->request->data['Add'])) { // call Add method }else if (isset($this->request->data['Edit'])) { // call Edit method }else if (isset($this->request->data['Delete'])) { // call Delete method } echo $this->Form->create('myModel' ); echo $this->Form->input('EmployeeID'); echo $this->Form->input('First Name' ); echo $this->Form->input('Last Name'); echo $this->Form->input('Departement'); echo $this->Form->input('Address'); echo $this->Form->submit('Search' , array('name' =>'Search' )); echo $this->Form->submit('Add' , array('name' =>'Add')); echo $this->Form->submit('Edit' , array('name' =>'Edit')); echo $this->Form->submit('Delete', array('name' =>'Delete' )); echo $this->form->end(); ?> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: search by field
Maybe $prod is empty? What happens when you add die(debug($prod)); after the find in the show function? Jeremy Burns Class Outfit http://www.classoutfit.com On 17 May 2013, at 05:22:19, Victor Daniel Ojeda wrote: > I have > > show.ctp > -- > foreach ($prod as $p): > echo $p['Producto']['id']; > echo $p['Producto']['descripcion']; > endforeach; > ?> > > > Producto.php (model) > --- > public function getProducto($descripcion = null) { > $this->find('all', array('conditions' => array('descripcion' => > $descripcion))); > } > > > and controller ProductosController.php > ---- > public function show() { > $descripcion = $this->request->data['Producto']['search']; > $prod = $this->Producto->getProducto($descripcion); > $this->set(compact('prod')); > } > > > but not work :( > > Warning (2): Invalid argument supplied for foreach() > [APP\View\Productos\show.ctp, line 2] > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
search by field
I have show.ctp -- Producto.php (model) --- public function getProducto($descripcion = null) { $this->find('all', array('conditions' => array('descripcion' => $descripcion))); } and controller ProductosController.php public function show() { $descripcion = $this->request->data['Producto']['search']; $prod = $this->Producto->getProducto($descripcion); $this->set(compact('prod')); } but not work :( *Warning* (2): Invalid argument supplied for foreach() [*APP\View\Productos\show.ctp*, line *2*] -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with Pagination of search results
That's perfect! thanks again! -- View this message in context: http://cakephp.1045679.n5.nabble.com/Problem-with-Pagination-of-search-results-tp5714685p5714707.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with Pagination of search results
Just having another look at your code that is using sessions... It looks as though when someone submits the form that contains the 'search' field, you are saving that to the session, but then checking for it's existence, reading it straight back out, and never doing the paginate. Here is snippet of your code, modified to make better use of the session for storing the search term. I've kept the session name the same, however, I would recommend calling it user_search, user_filter or just search, instead of users, since you're not actually storing users in the session. public function search() { // if form submitted, save search keyword to the session if (!empty($this -> data)) { $keyword = $this->data['User']['search']; $this->Session->write('users', $keyword); } // if we have a search keyword, set paginate conditions $conditions = array('1 = 1'); if ($this -> Session -> check('users')) { $keyword = $this -> Session -> read('users'); $conditions['or'] = array(array('User.first_name LIKE' => $keyword . '%'),array('User.last_name LIKE' => $keyword . '%')); } // always do a paginate $this->paginate = array('User' => array('conditions' => $conditions, 'limit' => 5)); $this->set('users', $this->paginate('User')); } On Tuesday, 30 April 2013 03:39:02 UTC+10, Lilit Bakunts wrote: > > I only had $this->Paginator->numbers() in view. > I'll try to make it via GET.. but after knowing how to use with sessions > :) > Thanks for your reply ! > > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Problem-with-Pagination-of-search-results-tp5714685p5714704.html > > Sent from the CakePHP mailing list archive at Nabble.com. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with Pagination of search results
I only had $this->Paginator->numbers() in view. I'll try to make it via GET.. but after knowing how to use with sessions :) Thanks for your reply ! -- View this message in context: http://cakephp.1045679.n5.nabble.com/Problem-with-Pagination-of-search-results-tp5714685p5714704.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Paginate search results
It looks like you are making a call to the PaginatorHelper in the view, when no actual pagination has taken place. And this happens when you submit the search form. Firstly, I would recommend not using a POST for your search form. Use a GET instead, so that everything is on the query string, and you don't need to rely on Sessions. I would also recommend setting up the paginator to use the query string, rather than named params, and you see why in the second. In your search form create, specify the url option to be $this->Paginator->url(). This make sure that when you post the search, via a GET, extra settings like the sort field and direction, what page you are on, and the limit are remembered. Also, when you specifiy $this->Paginator->sort(), also pass through $this->Paginator->url(), so that your search field is remembered when you change the sort. You may also need to do a similar thing for $this->Paginator->numbers(), first(), prev(), last() and next() (which reminds me, I better check the code I was working on today, doing just this very thing). By using $this->Paginator->url(), you can pass around the paginator parameters, and any extra params (like search filters), and by using GET in your form, each request is stateless, and doesn't require a session. On Sunday, 28 April 2013 04:17:43 UTC+10, Lilit Bakunts wrote: > > Hi people. > I'm new to cakephp and need your help. I have this search function in my > UsersController, so there's a problem with search result pagination. The > first page shows first five names properly, but next pages does not show > anything. I need that this session save all my users, then check and > basically read it in next pages. > so how it should be? > th error message > > *Undefined index: pageCount [CORE\Cake\View\Helper\PaginatorHelper.php, > line > 702]* > > and the > public function search() { > > if (!empty($this -> data)) { > $keyword = $this -> data['User']['search']; > $this -> Session -> write('users', $keyword); > > if ($this -> Session -> check('users')) { > $keyword = $this -> Session -> > read('users'); > > } elseif (isset($keyword, $this -> > data['User']['search'])) { > $this -> paginate = array('conditions' => > array('OR' => > array("User.first_name LIKE" => "$keyword%", "User.last_name LIKE" => > "$keyword%")), 'limit' => 5); > $this -> set('users', $this -> > paginate('User')); > > } > } > > pls helpp > Thanks in advance :) > > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Paginate-search-results-tp5714685.html > Sent from the CakePHP mailing list archive at Nabble.com. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with Pagination of search results
I see nobody knows... -- View this message in context: http://cakephp.1045679.n5.nabble.com/Problem-with-Pagination-of-search-results-tp5714685p5714690.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
General Search on Every Page - CakeDC Search
Hello, I'm very new to CakePHP and I'm liking it so far, but I'm running into some trouble when searching the database. I'm using the CakeDC Search plugin and I'm able to search on a particular page, but I'm not sure how I would implement it so that I have access to search on every page. Also, I want to have one search bar that searches for anything about the user or product. Here's what I would like to do: - On the top right of any page have a search bar - I want the user to be able to type anything pertaining to a product or user in the search bar. - I also want to have filters such as: zip code, city, state, address, etc. I've been looking for some examples and just can't find anything that covers what I'm looking for. Any help would be greatly appreciated. Thank You, Brett -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Paginate search results
Hi people. I'm new to cakephp and need your help. I have this search function in my UsersController, so there's a problem with search result pagination. The first page shows first five names properly, but next pages does not show anything. I need that this session save all my users, then check and basically read it in next pages. so how it should be? th error message *Undefined index: pageCount [CORE\Cake\View\Helper\PaginatorHelper.php, line 702]* and the public function search() { if (!empty($this -> data)) { $keyword = $this -> data['User']['search']; $this -> Session -> write('users', $keyword); if ($this -> Session -> check('users')) { $keyword = $this -> Session -> read('users'); } elseif (isset($keyword, $this -> data['User']['search'])) { $this -> paginate = array('conditions' => array('OR' => array("User.first_name LIKE" => "$keyword%", "User.last_name LIKE" => "$keyword%")), 'limit' => 5); $this -> set('users', $this -> paginate('User')); } } pls helpp Thanks in advance :) -- View this message in context: http://cakephp.1045679.n5.nabble.com/Paginate-search-results-tp5714685.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
currently the searching only for searching for name field. the result only select the name that equivalent to the search query. now i try to create condition for example like search based on name and gender. need to figure out how to do that.hmmm On Tuesday, 16 April 2013 07:14:46 UTC+8, cricket wrote: > > What does the resulting query look like? Does it include the condition > with the submitted name? > > > On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf > > > wrote: > >> Actually i already Google several search plugin for CakePHP but most of >> CakePHP user recommended search plugin from CakeDC. So, i download the >> plugin from https://github.com/dereuromark/search and load the plugin >> with code: CakePlugin::load('Search'); in bootstrap.php >> >> Then i implement the code for my file controller: >> >> public $components = array('Search.Prg'); >> public $presetVars = true; // using the model configuration >> public function find() { >> $this->Prg->commonProcess(); >> $this->paginate['conditions'] = >> $this->Patient->parseCriteria($this->passedArgs); >> $this->set('patients', $this->paginate()); >> } >> * >> * >> * >> * >> For the model, i put this code: >> >> public $actsAs = array('Search.Searchable'); >> public $filterArgs = array( >> array('name' => 'name', 'type' => 'query', 'method' => >> 'filterName'), >> ); >> >> public function filterName($data, $field = null) { >> if (empty($data['name'])) { >> return array(); >> } >> $nameField = '%' . $data['name'] . '%'; >> return array( >> 'OR' => array( >> $this->alias . '.name LIKE' => $nameField, >> )); >> } >> >> For the view (find.ctp), i put this code for the form: (others code are >> exactly same as view/index.ctp) >> >> > echo $this->Form->create('Patient', array( >> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >> )); >> echo $this->Form->input('name', array('div' => false)); >> echo $this->Form->submit(__('Search'), array('div' => false)); >> echo $this->Form->end(); >> ?> >> >> >> What i try to achieve is the search plugin will do searching for "name" >> from table patients. However, this code seems not working but in the URL, >> once i do searching for example i "John" as the search term, the URL bar >> show as patients/find/name:john but the list of record are not showing john >> record only but still show all records instead of john only. >> >> As for the information i use CakePHP ver: 2.3.1. Is it any problem with >> the codes or any depreciate attributes in the coding? Sorry if this >> question repeated in this group but i still unable to find any solution. >> Most of the user claimed that it is easy to use this plugin but i'm still >> new in CakePHP. Hope someone can help me. >> >> Thanks :) >> >> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+u...@googlegroups.com . >> To post to this group, send email to cake...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/cake-php?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
It works now! thank you so much euromark and cricket!!! really appreciate your help man! Just a single line of code can solve the problem. nice! On Tuesday, 16 April 2013 07:09:01 UTC+8, cricket wrote: > > You can get rid of that notice by declaring the $paginate array as a class > var: > > public $paginate = array(); > public $components = ... > > > On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf > > > wrote: > >> I've made the amendment to the code but still the result are same. no >> search result produced and i notice there is warning on top of the page say: >> >> Notice (8): Indirect modification of overloaded property >> PatientsController::$paginate has no effect >> [APP\Controller\PatientsController.php, line 14] >> >> where the code that caused the notice to appear is: >> >> $this->paginate['conditions'] = >> $this->Patient->parseCriteria($this->passedArgs); >> >> is there any other codes that i've missed? Thanks a lot :) >> >> >> On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote: >>> >>> I would use string array keys: >>> >>> public $filterArgs = array( >>> 'name' => array('type' => 'query', 'method' => 'filterName'), >>> ); >>> >>> but both ways should work >>> >>> PS: echo $this->Form->create('Patient') is enough, as it automatically >>> posts to itself >>> >>> >>> >>> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf: >>>> >>>> Actually i already Google several search plugin for CakePHP but most of >>>> CakePHP user recommended search plugin from CakeDC. So, i download the >>>> plugin from >>>> https://github.com/**dereuromark/search<https://github.com/dereuromark/search> >>>> and >>>> load the plugin with code: CakePlugin::load('**Search'); in >>>> bootstrap.php >>>> >>>> Then i implement the code for my file controller: >>>> >>>> public $components = array('Search.Prg'); >>>> public $presetVars = true; // using the model configuration >>>> public function find() { >>>> $this->Prg->commonProcess(); >>>> $this->paginate['conditions'] = $this->Patient->parseCriteria(* >>>> *$this->passedArgs); >>>> $this->set('patients', $this->paginate()); >>>> } >>>> * >>>> * >>>> * >>>> * >>>> For the model, i put this code: >>>> >>>> public $actsAs = array('Search.Searchable'); >>>> public $filterArgs = array( >>>> array('name' => 'name', 'type' => 'query', 'method' => >>>> 'filterName'), >>>> ); >>>> >>>> public function filterName($data, $field = null) { >>>> if (empty($data['name'])) { >>>> return array(); >>>> } >>>> $nameField = '%' . $data['name'] . '%'; >>>> return array( >>>> 'OR' => array( >>>> $this->alias . '.name LIKE' => $nameField, >>>> )); >>>> } >>>> >>>> For the view (find.ctp), i put this code for the form: (others code are >>>> exactly same as view/index.ctp) >>>> >>>> >>> echo $this->Form->create('Patient', array( >>>> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >>>> )); >>>> echo $this->Form->input('name', array('div' => false)); >>>> echo $this->Form->submit(__('**Search'), array('div' => false)); >>>> echo $this->Form->end(); >>>> ?> >>>> >>>> >>>> What i try to achieve is the search plugin will do searching for "name" >>>> from table patients. However, this code seems not working but in the URL, >>>> once i do searching for example i "John" as the search term, the URL bar >&g
Re: Records search using CakeDC/search
What does the resulting query look like? Does it include the condition with the submitted name? On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf wrote: > Actually i already Google several search plugin for CakePHP but most of > CakePHP user recommended search plugin from CakeDC. So, i download the > plugin from https://github.com/dereuromark/search and load the plugin > with code: CakePlugin::load('Search'); in bootstrap.php > > Then i implement the code for my file controller: > > public $components = array('Search.Prg'); > public $presetVars = true; // using the model configuration > public function find() { > $this->Prg->commonProcess(); > $this->paginate['conditions'] = > $this->Patient->parseCriteria($this->passedArgs); > $this->set('patients', $this->paginate()); > } > * > * > * > * > For the model, i put this code: > > public $actsAs = array('Search.Searchable'); > public $filterArgs = array( > array('name' => 'name', 'type' => 'query', 'method' => > 'filterName'), > ); > > public function filterName($data, $field = null) { > if (empty($data['name'])) { > return array(); > } > $nameField = '%' . $data['name'] . '%'; > return array( > 'OR' => array( > $this->alias . '.name LIKE' => $nameField, > )); > } > > For the view (find.ctp), i put this code for the form: (others code are > exactly same as view/index.ctp) > > echo $this->Form->create('Patient', array( > 'url' => array_merge(array('action' => 'find'), $this->params['pass']) > )); > echo $this->Form->input('name', array('div' => false)); > echo $this->Form->submit(__('Search'), array('div' => false)); > echo $this->Form->end(); > ?> > > > What i try to achieve is the search plugin will do searching for "name" > from table patients. However, this code seems not working but in the URL, > once i do searching for example i "John" as the search term, the URL bar > show as patients/find/name:john but the list of record are not showing john > record only but still show all records instead of john only. > > As for the information i use CakePHP ver: 2.3.1. Is it any problem with > the codes or any depreciate attributes in the coding? Sorry if this > question repeated in this group but i still unable to find any solution. > Most of the user claimed that it is easy to use this plugin but i'm still > new in CakePHP. Hope someone can help me. > > Thanks :) > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
You can get rid of that notice by declaring the $paginate array as a class var: public $paginate = array(); public $components = ... On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf wrote: > I've made the amendment to the code but still the result are same. no > search result produced and i notice there is warning on top of the page say: > > Notice (8): Indirect modification of overloaded property > PatientsController::$paginate has no effect > [APP\Controller\PatientsController.php, line 14] > > where the code that caused the notice to appear is: > > $this->paginate['conditions'] = > $this->Patient->parseCriteria($this->passedArgs); > > is there any other codes that i've missed? Thanks a lot :) > > > On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote: >> >> I would use string array keys: >> >> public $filterArgs = array( >> 'name' => array('type' => 'query', 'method' => 'filterName'), >> ); >> >> but both ways should work >> >> PS: echo $this->Form->create('Patient') is enough, as it automatically >> posts to itself >> >> >> >> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf: >>> >>> Actually i already Google several search plugin for CakePHP but most of >>> CakePHP user recommended search plugin from CakeDC. So, i download the >>> plugin from >>> https://github.com/**dereuromark/search<https://github.com/dereuromark/search> >>> and >>> load the plugin with code: CakePlugin::load('**Search'); in >>> bootstrap.php >>> >>> Then i implement the code for my file controller: >>> >>> public $components = array('Search.Prg'); >>> public $presetVars = true; // using the model configuration >>> public function find() { >>> $this->Prg->commonProcess(); >>> $this->paginate['conditions'] = $this->Patient->parseCriteria(** >>> $this->passedArgs); >>> $this->set('patients', $this->paginate()); >>> } >>> * >>> * >>> * >>> * >>> For the model, i put this code: >>> >>> public $actsAs = array('Search.Searchable'); >>> public $filterArgs = array( >>> array('name' => 'name', 'type' => 'query', 'method' => >>> 'filterName'), >>> ); >>> >>> public function filterName($data, $field = null) { >>> if (empty($data['name'])) { >>> return array(); >>> } >>> $nameField = '%' . $data['name'] . '%'; >>> return array( >>> 'OR' => array( >>> $this->alias . '.name LIKE' => $nameField, >>> )); >>> } >>> >>> For the view (find.ctp), i put this code for the form: (others code are >>> exactly same as view/index.ctp) >>> >>> >> echo $this->Form->create('Patient', array( >>> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >>> )); >>> echo $this->Form->input('name', array('div' => false)); >>> echo $this->Form->submit(__('**Search'), array('div' => false)); >>> echo $this->Form->end(); >>> ?> >>> >>> >>> What i try to achieve is the search plugin will do searching for "name" >>> from table patients. However, this code seems not working but in the URL, >>> once i do searching for example i "John" as the search term, the URL bar >>> show as patients/find/name:john but the list of record are not showing john >>> record only but still show all records instead of john only. >>> >>> As for the information i use CakePHP ver: 2.3.1. Is it any problem with >>> the codes or any depreciate attributes in the coding? Sorry if this >>> question repeated in this group but i still unable to find any solution. >>> Most of the user claimed that it is easy to use this plugin but i'm still >>> new in CakePHP. Hope someone can help me. >>> >>> Thanks :) >>> >>> -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Simple Search Engine
hi, I need my website search all content about user query... contents that be searched is news table, articles table, etc. I do'nt know how to implement this that easiest & local search... please help me. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
I've made the amendment to the code but still the result are same. no search result produced and i notice there is warning on top of the page say: Notice (8): Indirect modification of overloaded property PatientsController::$paginate has no effect [APP\Controller\PatientsController.php, line 14] where the code that caused the notice to appear is: $this->paginate['conditions'] = $this->Patient->parseCriteria($this->passedArgs); is there any other codes that i've missed? Thanks a lot :) On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote: > > I would use string array keys: > > public $filterArgs = array( > 'name' => array('type' => 'query', 'method' => 'filterName'), > ); > > but both ways should work > > PS: echo $this->Form->create('Patient') is enough, as it automatically > posts to itself > > > > Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf: >> >> Actually i already Google several search plugin for CakePHP but most of >> CakePHP user recommended search plugin from CakeDC. So, i download the >> plugin from https://github.com/dereuromark/search and load the plugin >> with code: CakePlugin::load('Search'); in bootstrap.php >> >> Then i implement the code for my file controller: >> >> public $components = array('Search.Prg'); >> public $presetVars = true; // using the model configuration >> public function find() { >> $this->Prg->commonProcess(); >> $this->paginate['conditions'] = >> $this->Patient->parseCriteria($this->passedArgs); >> $this->set('patients', $this->paginate()); >> } >> * >> * >> * >> * >> For the model, i put this code: >> >> public $actsAs = array('Search.Searchable'); >> public $filterArgs = array( >> array('name' => 'name', 'type' => 'query', 'method' => >> 'filterName'), >> ); >> >> public function filterName($data, $field = null) { >> if (empty($data['name'])) { >> return array(); >> } >> $nameField = '%' . $data['name'] . '%'; >> return array( >> 'OR' => array( >> $this->alias . '.name LIKE' => $nameField, >> )); >> } >> >> For the view (find.ctp), i put this code for the form: (others code are >> exactly same as view/index.ctp) >> >> > echo $this->Form->create('Patient', array( >> 'url' => array_merge(array('action' => 'find'), $this->params['pass']) >> )); >> echo $this->Form->input('name', array('div' => false)); >> echo $this->Form->submit(__('Search'), array('div' => false)); >> echo $this->Form->end(); >> ?> >> >> >> What i try to achieve is the search plugin will do searching for "name" >> from table patients. However, this code seems not working but in the URL, >> once i do searching for example i "John" as the search term, the URL bar >> show as patients/find/name:john but the list of record are not showing john >> record only but still show all records instead of john only. >> >> As for the information i use CakePHP ver: 2.3.1. Is it any problem with >> the codes or any depreciate attributes in the coding? Sorry if this >> question repeated in this group but i still unable to find any solution. >> Most of the user claimed that it is easy to use this plugin but i'm still >> new in CakePHP. Hope someone can help me. >> >> Thanks :) >> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Records search using CakeDC/search
I would use string array keys: public $filterArgs = array( 'name' => array('type' => 'query', 'method' => 'filterName'), ); but both ways should work PS: echo $this->Form->create('Patient') is enough, as it automatically posts to itself Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf: > > Actually i already Google several search plugin for CakePHP but most of > CakePHP user recommended search plugin from CakeDC. So, i download the > plugin from https://github.com/dereuromark/search and load the plugin > with code: CakePlugin::load('Search'); in bootstrap.php > > Then i implement the code for my file controller: > > public $components = array('Search.Prg'); > public $presetVars = true; // using the model configuration > public function find() { > $this->Prg->commonProcess(); > $this->paginate['conditions'] = > $this->Patient->parseCriteria($this->passedArgs); > $this->set('patients', $this->paginate()); > } > * > * > * > * > For the model, i put this code: > > public $actsAs = array('Search.Searchable'); > public $filterArgs = array( > array('name' => 'name', 'type' => 'query', 'method' => > 'filterName'), > ); > > public function filterName($data, $field = null) { > if (empty($data['name'])) { > return array(); > } > $nameField = '%' . $data['name'] . '%'; > return array( > 'OR' => array( > $this->alias . '.name LIKE' => $nameField, > )); > } > > For the view (find.ctp), i put this code for the form: (others code are > exactly same as view/index.ctp) > > echo $this->Form->create('Patient', array( > 'url' => array_merge(array('action' => 'find'), $this->params['pass']) > )); > echo $this->Form->input('name', array('div' => false)); > echo $this->Form->submit(__('Search'), array('div' => false)); > echo $this->Form->end(); > ?> > > > What i try to achieve is the search plugin will do searching for "name" > from table patients. However, this code seems not working but in the URL, > once i do searching for example i "John" as the search term, the URL bar > show as patients/find/name:john but the list of record are not showing john > record only but still show all records instead of john only. > > As for the information i use CakePHP ver: 2.3.1. Is it any problem with > the codes or any depreciate attributes in the coding? Sorry if this > question repeated in this group but i still unable to find any solution. > Most of the user claimed that it is easy to use this plugin but i'm still > new in CakePHP. Hope someone can help me. > > Thanks :) > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Records search using CakeDC/search
Actually i already Google several search plugin for CakePHP but most of CakePHP user recommended search plugin from CakeDC. So, i download the plugin from https://github.com/dereuromark/search and load the plugin with code: CakePlugin::load('Search'); in bootstrap.php Then i implement the code for my file controller: public $components = array('Search.Prg'); public $presetVars = true; // using the model configuration public function find() { $this->Prg->commonProcess(); $this->paginate['conditions'] = $this->Patient->parseCriteria($this->passedArgs); $this->set('patients', $this->paginate()); } * * * * For the model, i put this code: public $actsAs = array('Search.Searchable'); public $filterArgs = array( array('name' => 'name', 'type' => 'query', 'method' => 'filterName'), ); public function filterName($data, $field = null) { if (empty($data['name'])) { return array(); } $nameField = '%' . $data['name'] . '%'; return array( 'OR' => array( $this->alias . '.name LIKE' => $nameField, )); } For the view (find.ctp), i put this code for the form: (others code are exactly same as view/index.ctp) Form->create('Patient', array( 'url' => array_merge(array('action' => 'find'), $this->params['pass']) )); echo $this->Form->input('name', array('div' => false)); echo $this->Form->submit(__('Search'), array('div' => false)); echo $this->Form->end(); ?> What i try to achieve is the search plugin will do searching for "name" from table patients. However, this code seems not working but in the URL, once i do searching for example i "John" as the search term, the URL bar show as patients/find/name:john but the list of record are not showing john record only but still show all records instead of john only. As for the information i use CakePHP ver: 2.3.1. Is it any problem with the codes or any depreciate attributes in the coding? Sorry if this question repeated in this group but i still unable to find any solution. Most of the user claimed that it is easy to use this plugin but i'm still new in CakePHP. Hope someone can help me. Thanks :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Share : CakeStrap - Ajax Template (CRUD, Search)
i was integrated : - CakePHP + Bootstrap + JQuery (CakeStrap) - Table : Categories -* id int primary key auto inc -* name varchar check this : http://www.itoey.com/hexa.zip note: Indonesian Language -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?
The correct approach as outlined in the readme is to use the array syntax: 'field' => array('User.name', 'User.email', 'Profile.name', 'Profile.phone') Now it works, I don't know why I didn't see that. Thank you. -- View this message in context: http://cakephp.1045679.n5.nabble.com/CakeDC-Search-Plugin-How-to-search-2-fields-in-DB-using-only-1-form-field-tp5164502p5714325.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?
You need to pay more attention to the documentation "AND `User.name, User.email, Profile.name, Profile.phone` LIKE" is invalid SQL which you get when you do it wrong. The correct approach as outlined in the readme is to use the array syntax: 'field' => array('User.name', 'User.email', 'Profile.name', 'Profile.phone') Note that you got 4 array elements here instead of one long one as in your case. Am Donnerstag, 28. März 2013 20:33:20 UTC+1 schrieb Sergio Eustaquio Pereda Saviñón: > > > > with my bugfixed and enhanced version you > can:https://github.com/dereuromark/search > > > > > but you should use an array structure then - like that: > > > > > 'field'=>array('Model1.entry1', 'Model1.entry2', > > > 'Model2.entry2', ...) > > > > I'm using Cakephp V 2.3.1, and the plugin from Dereuromark branch fixed. > > Im getting this error: > Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.name, > User.email, Profile.name, Profile.phone' in 'where clause' > > Database error: > SQL Query: SELECT `User`.`id`, `User`.`name`, `User`.`email`, > `User`.`password`, `User`.`login_id`, `User`.`profile_id`, > `User`.`activate`, `User`.`is_sadmin`, `User`.`ubuildinghive`, > `User`.`ustaff`, > ... > `Profile`.`name`, `Profile`.`email2`, `Profile`.`app`, `Profile`.`apm`, > `Profile`.`phone`, > > `Pbpermission`.`advertising`, `Pbpermission`.`techsupport`, > `Pbpermission`.`company`, > > FROM `buildhive`.`users` AS `User` LEFT JOIN `buildhive`.`profiles` AS > `Profile` ON (`User`.`profile_id` = `Profile`.`id`) LEFT JOIN > `buildhive`.`pbpermissions` AS `Pbpermission` ON (`User`.`pbpermission_id` > = > `Pbpermission`.`id`) **WHERE `ubuildinghive` = 1 AND `User.name, > User.email, > Profile.name, Profile.phone` LIKE '%adf%' LIMIT 20 > > User Model: > public $actsAs = array('Search.Searchable', 'Containable'); > > public $filterArgs = array( > 'pbpermission_id' => array('type' => 'like'), > 'search_email' => array('type' => 'like', 'field' > => 'User.email'), > 'pname' => array('type' => 'like', 'field' => > 'Profile.name'), > 'phone' => array('type' => 'like', 'field' => > 'Profile.phone'), > 'advanced' => array('type' => 'like', 'encode' => > true, 'field' => > array('User.name, User.email, Profile.name, Profile.phone') ) > ); > > > User Controller: > CakePlugin::load( array('Search') ); > public $components = array('Search.Prg'); > public $presetVars = true; > > public function index: > $this->Prg->commonProcess(); > $this->paginate = array('User' => array('contain' => array('Profile', > 'Pbpermission') ) ); > > $conditions = array('ubuildinghive' => 1 ); > $options = array_merge($conditions, > $this->User->parseCriteria($this->passedArgs) ); > $users = $this->paginate('User', $options ); > > > Please help , > > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/CakeDC-Search-Plugin-How-to-search-2-fields-in-DB-using-only-1-form-field-tp5164502p5714305.html > > Sent from the CakePHP mailing list archive at Nabble.com. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?
> > with my bugfixed and enhanced version you can:https://github.com/dereuromark/search > > > but you should use an array structure then - like that: > > > 'field'=>array('Model1.entry1', 'Model1.entry2', > > 'Model2.entry2', ...) > I'm using Cakephp V 2.3.1, and the plugin from Dereuromark branch fixed. Im getting this error: Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.name, User.email, Profile.name, Profile.phone' in 'where clause' Database error: SQL Query: SELECT `User`.`id`, `User`.`name`, `User`.`email`, `User`.`password`, `User`.`login_id`, `User`.`profile_id`, `User`.`activate`, `User`.`is_sadmin`, `User`.`ubuildinghive`, `User`.`ustaff`, ... `Profile`.`name`, `Profile`.`email2`, `Profile`.`app`, `Profile`.`apm`, `Profile`.`phone`, `Pbpermission`.`advertising`, `Pbpermission`.`techsupport`, `Pbpermission`.`company`, FROM `buildhive`.`users` AS `User` LEFT JOIN `buildhive`.`profiles` AS `Profile` ON (`User`.`profile_id` = `Profile`.`id`) LEFT JOIN `buildhive`.`pbpermissions` AS `Pbpermission` ON (`User`.`pbpermission_id` = `Pbpermission`.`id`) **WHERE `ubuildinghive` = 1 AND `User.name, User.email, Profile.name, Profile.phone` LIKE '%adf%' LIMIT 20 User Model: public $actsAs = array('Search.Searchable', 'Containable'); public $filterArgs = array( 'pbpermission_id' => array('type' => 'like'), 'search_email' => array('type' => 'like', 'field' => 'User.email'), 'pname' => array('type' => 'like', 'field' => 'Profile.name'), 'phone' => array('type' => 'like', 'field' => 'Profile.phone'), 'advanced' => array('type' => 'like', 'encode' => true, 'field' => array('User.name, User.email, Profile.name, Profile.phone') ) ); User Controller: CakePlugin::load( array('Search') ); public $components = array('Search.Prg'); public $presetVars = true; public function index: $this->Prg->commonProcess(); $this->paginate = array('User' => array('contain' => array('Profile', 'Pbpermission') ) ); $conditions = array('ubuildinghive' => 1 ); $options = array_merge($conditions, $this->User->parseCriteria($this->passedArgs) ); $users = $this->paginate('User', $options ); Please help , -- View this message in context: http://cakephp.1045679.n5.nabble.com/CakeDC-Search-Plugin-How-to-search-2-fields-in-DB-using-only-1-form-field-tp5164502p5714305.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search filter in cake 1.3
anyone,...? -- View this message in context: http://cakephp.1045679.n5.nabble.com/search-filter-in-cake-1-3-tp5713935p5713955.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search filter in cake 1.3
Try this function search() { $this->User->recursive = 0; $params = $this->params['url']; if (!array_key_exists("find", $params)) { $this->set('users', $this->paginate('User')); } else { $this->set('users', $this->paginate('User',array('User.firstname LIKE'=>$params['find'].'%'))); } } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search filter in cake 1.3
hi cricket,... thank you for your reply,... I have tried it,... and still have no luck,... $this->User->recursive = 0; $params = $this->params['url']; if (!array_key_exists("find", $params)) { $this->set('users', $this->paginate()); } else { $this->set('users', $this->paginate = array( 'limit' => $limit, 'page' => $page, 'conditions' => array( "MATCH(User.firstname) AGAINST('${q}' IN BOOLEAN MODE)" ), 'contain' => array() ) ); } On Monday, March 4, 2013 4:56:18 PM UTC-8, cricket wrote: > > $this->paginate = array( > 'limit' => $limit, > 'page' => $page, > 'conditions' => array( > "MATCH(User.firstname) AGAINST('${q}' IN BOOLEAN MODE)" > ), > 'contain' => array() > ); > > The $limit & $page vars are gotten from $this->request. And you really > should be escaping the find param with the Sanitize class. The "IN > BOOLEAN MODE"part is of course optional. > > On Mon, Mar 4, 2013 at 6:49 PM, Chris > > wrote: > > anyone? > > > > On Sunday, March 3, 2013 4:45:08 PM UTC-8, Chris wrote: > >> > >> hi guys,... can anyone help please,... I'm using cake 1.3 > >> how can I filter search results by user firstname > >> > >> this is my form input: > >> > >> Form->create('User', array('action' => 'search')); ?> > >> Form->text('find', array('style' => 'width: 60px')) > >> ?> > >> Form->end(__('Search', true)); ?> > >> > >> and this is my users_controller.php > >> > >> > >> function search() > >> { > >> > >> $this->User->recursive = 0; > >> $params = $this->params['url']; > >> > >> if (!array_key_exists("find", $params)) { > >> > >> $this->set('users', $this->paginate()); > >> } > >> else > >> { > >> $this->set('users', $this->paginate(array("User.firstname LIKE > >> '{$params['find']}%'"))); > >> } > >> > >> } > >> > >> thanks in advance > >> chris > >> > > -- > > Like Us on FaceBook https://www.facebook.com/CakePHP > > Find us on Twitter http://twitter.com/CakePHP > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "CakePHP" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to cake-php+u...@googlegroups.com . > > To post to this group, send email to cake...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search filter in cake 1.3
$this->paginate = array( 'limit' => $limit, 'page' => $page, 'conditions' => array( "MATCH(User.firstname) AGAINST('${q}' IN BOOLEAN MODE)" ), 'contain' => array() ); The $limit & $page vars are gotten from $this->request. And you really should be escaping the find param with the Sanitize class. The "IN BOOLEAN MODE"part is of course optional. On Mon, Mar 4, 2013 at 6:49 PM, Chris wrote: > anyone? > > On Sunday, March 3, 2013 4:45:08 PM UTC-8, Chris wrote: >> >> hi guys,... can anyone help please,... I'm using cake 1.3 >> how can I filter search results by user firstname >> >> this is my form input: >> >> Form->create('User', array('action' => 'search')); ?> >> Form->text('find', array('style' => 'width: 60px')) >> ?> >> Form->end(__('Search', true)); ?> >> >> and this is my users_controller.php >> >> >> function search() >> { >> >> $this->User->recursive = 0; >> $params = $this->params['url']; >> >> if (!array_key_exists("find", $params)) { >> >> $this->set('users', $this->paginate()); >> } >> else >> { >> $this->set('users', $this->paginate(array("User.firstname LIKE >> '{$params['find']}%'"))); >> } >> >> } >> >> thanks in advance >> chris >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search filter in cake 1.3
anyone? On Sunday, March 3, 2013 4:45:08 PM UTC-8, Chris wrote: > > hi guys,... can anyone help please,... I'm using cake 1.3 > how can I filter search results by user firstname > > this is my form input: > > Form->create('User', array('action' => 'search')); ?> > Form->text('find', array('style' => 'width: 60px')) > ?> > Form->end(__('Search', true)); ?> > > and this is my users_controller.php > > > function search() > { > > $this->User->recursive = 0; > $params = $this->params['url']; > > if (!array_key_exists("find", $params)) { > > $this->set('users', $this->paginate()); > } > else > { > $this->set('users', $this->paginate(array("User.firstname LIKE > '{$params['find']}%'"))); > } > > } > > thanks in advance > chris > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
search filter in cake 1.3
hi guys,... can anyone help please,... I'm using cake 1.3 how can I filter search results by user firstname this is my form input: Form->create('User', array('action' => 'search')); ?> Form->text('find', array('style' => 'width: 60px')) ?> Form->end(__('Search', true)); ?> and this is my users_controller.php function search() { $this->User->recursive = 0; $params = $this->params['url']; if (!array_key_exists("find", $params)) { $this->set('users', $this->paginate()); } else { $this->set('users', $this->paginate(array("User.firstname LIKE '{$params['find']}%'"))); } } thanks in advance chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Cake PHP Search Component not working and giving an error
Lets not try to duplicate everything and stay on http://stackoverflow.com/questions/14936595/search-functionality-not-working-using-id-field-input The main question still stands: If you use "name" as form field, why are you declaring they key in your behavior as "id"? it should then also be "name" to match. You may answer at SO. Am Montag, 18. Februar 2013 09:43:46 UTC+1 schrieb Victor Musvibe: > > Hi Bakers > > I implemented a search component from this url > http://www.designaeon.com/cake-php-search-component/ but I have a few > problems. At first Cake didn’t recognize the component. After I renamed > search.php in SearchComponent.php > > I got another Error: Declaration of SearchComponent::initialize() should > be compatible with Component::initialize(Controller $controller) > [APP/Controller/Component/SearchComponent.php, line 40] > > Below is my code for SearchComponent > > class SearchComponent extends Component { > > var $controller = null; > > function initialize(&$controller) > { > $this->controller = $controller; > } > > function getConditions(){ > $conditions = array(); > $data= empty($this->controller->params['named']) ? > $this->controller->params['url'] : $this->controller->params['named'] ; > $this->controller->{$this->controller->modelClass}->schema(); > foreach($data as $key=>$value){ > > if(isset($this->controller->{$this->controller->modelClass}->_schema[$key]) > && !empty($value)){ > > switch($this->controller->{$this->controller->modelClass}->_schema[$key]['type']){ > case "string": > $conditions[$this->controller->modelClass . "." .$key . " LIKE"] = > "%".trim($value)."%"; > break; > case "integer": > $conditions[$this->controller->modelClass . "." .$key] = $value; > break; > case "date": > if(isset($this->controller->params['named'][$key."_fromdate"])){ > $from = date("Y-m-d", strtotime( > $this->controller->params['named'][$key."_fromdate"] )); > $conditions[$this->controller->modelClass.".".$key." >="] = > trim($from); > } > if(isset($this->controller->params['named'][$key."_todate"])){ > $to = date("Y-m-d", strtotime($this->params['named'][$key."_todate"])); > $conditions[$this->controller->modelClass.".".$key." <="] = $to; > } > } > } > } > return $conditions; > > } > > } > ?> > > and in my index view i am using this code > > > element('SearchForm/set_pagination_named');?>//set > pagination named element > element('SearchForm/form') ?>//search form element > > > > > Paginator->sort('id');?> > > > > $i = 0; > foreach ($itSupportRequests as $itSupportRequest): > if ($i++ % 2 == 0) { > } > ?> > > ?> > > > Html->link(__('Edit', true), array('action' => > 'edit', $itSupportRequest['ItSupportRequest']['id'])); ?> > Html->link(__('Delete', true), array('action' => > 'delete', $itSupportRequest['ItSupportRequest']['id']), null, > sprintf(__('Are you sure you want to delete # %s?', true), > $itSupportRequest['ItSupportRequest']['id'])); ?> > > > > > > > > > I have created 2 Elements SearchForm/form.ctp and > SearchForm/set_pagination_named.ctp > > /*form.ctp*/ > > > Search params['controller'] ?> > Form->create(array('action' => 'index', 'type' => > 'GET')); ?> > Form->input('id', array( > 'label'=>'ID','type'=>'text')); > echo $this->Form->submit('Search',array('class'=>'button')); > ?> > > Form->end(); ?> > > > > and here is my set_pagination_named.ctp > > $data_arr=array(); > if(isset($this->params['url']) || isset($this->params['named'])){ > $data=isset($this->params['named'] ) && !empty($this->params['named']) > ? $this->params['named']:$this->params['url']; > $possibledata=array('id');//possible fields > foreach($data as $key=>$value){ > if(in_array($key,$possibledata) && !empty($value)){ > $data_arr[$key]=$data[$key]; > } > } > } > ?> > $this->Paginator->options(array( > 'evalScripts' => true, > 'url'=>$data_arr > )); > ?> > > Thank you in advance. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Cake PHP Search Component not working and giving an error
Hi Euromark I am using the search plugin on https://github.com/cakedc/search. I am trying to search for records using the ID field only, that is if i type in 1 on my form input it must show a record with user ID 1. The challenge that i am having now is when i specify that the input should be the id field, the input field for the search functionality disappears on my index view, strange thing is when i specify a different field name the input field shows. Below is my code for my Model public $actsAs = array('Search.Searchable'); public $filterArgs = array( 'id' => array('type' => 'like', 'field' => 'ItSupportRequest.id'), ); public function findByTags($data = array()) { $this->Tagged->Behaviors->attach('Containable', array('autoFields' => false)); $this->Tagged->Behaviors->attach('Search.Searchable'); $query = $this->Tagged->getQuery('all', array( 'conditions' => array('Tag.name' => $data['tags']), 'fields' => array('foreign_key'), 'contain' => array('Tag') )); return $query; } public function orConditions($data = array()) { $filter = $data['filter']; $cond = array( 'OR' => array( $this->alias . '.id LIKE' => '%' . $filter . '%', )); return $cond; } and here is my controller code. public $components = array('Search.Prg'); public $presetVars = true; // using the model configuration public function find() { $this->Prg->commonProcess(); $this->paginate['conditions'] = $this->ItSupportRequest->parseCriteria($this->passedArgs); $this->set('articles', $this->paginate()); } and in my index.ctp file i have this code. Form->create('ItSupportRequest', array( 'url' => array_merge(array('action' => 'find'), $this->params['pass']) )); echo $this->Form->label('Query ID:') . ""; echo $this->Form->input('name', array('div' => false, 'label' => false)); echo $this->Form->submit(__('Search'), array('div' => false)); echo $this->Form->end(); ?> Thanks Victor On Mon, Feb 18, 2013 at 1:10 PM, euromark wrote: > You would need to properly upgrade the component and make it work with > your version of cake. > > I propose you try https://github.com/cakedc/search > It is up to date, more sophisticated and does the job with less > configuration > > > > Am Montag, 18. Februar 2013 09:43:46 UTC+1 schrieb Victor Musvibe: > >> Hi Bakers >> >> I implemented a search component from this url http://www.designaeon.com/ >> **cake-php-search-component/<http://www.designaeon.com/cake-php-search-component/>but >> I have a few problems. At first Cake didn’t recognize the component. >> After I renamed search.php in SearchComponent.php >> >> I got another Error: Declaration of SearchComponent::initialize() should >> be compatible with Component::initialize(**Controller $controller) >> [APP/Controller/Component/**SearchComponent.php, line 40] >> >> Below is my code for SearchComponent >> >> > class SearchComponent extends Component { >> >> var $controller = null; >> >> function initialize(&$controller) >> { >> $this->controller = $controller; >> } >> >> function getConditions(){ >> $conditions = array(); >> $data= empty($this->controller->**params['named']) ? >> $this->controller->params['**url'] : $this->controller->params['**named'] >> ; >> $this->controller->{$this->**controller->modelClass}->**schema(); >> >> foreach($data as $key=>$value){ >> >> if(isset($this->controller->{$**this->controller->modelClass}-**>_schema[$key]) >> && !empty($value)){ >> switch($this->controller->{$**this->controller->modelClass}-** >> >_schema[$key]['type']){ >> case "string": >> $conditions[$this->controller-**>modelClass . "." .$key . " LIKE"] >> = "%".trim($value)."%"; >> break; >> case "integer": >> $conditions[$this->controller-**>modelClass . ".&
Re: Cake PHP Search Component not working and giving an error
You would need to properly upgrade the component and make it work with your version of cake. I propose you try https://github.com/cakedc/search It is up to date, more sophisticated and does the job with less configuration Am Montag, 18. Februar 2013 09:43:46 UTC+1 schrieb Victor Musvibe: > > Hi Bakers > > I implemented a search component from this url > http://www.designaeon.com/cake-php-search-component/ but I have a few > problems. At first Cake didn’t recognize the component. After I renamed > search.php in SearchComponent.php > > I got another Error: Declaration of SearchComponent::initialize() should > be compatible with Component::initialize(Controller $controller) > [APP/Controller/Component/SearchComponent.php, line 40] > > Below is my code for SearchComponent > > class SearchComponent extends Component { > > var $controller = null; > > function initialize(&$controller) > { > $this->controller = $controller; > } > > function getConditions(){ > $conditions = array(); > $data= empty($this->controller->params['named']) ? > $this->controller->params['url'] : $this->controller->params['named'] ; > $this->controller->{$this->controller->modelClass}->schema(); > foreach($data as $key=>$value){ > > if(isset($this->controller->{$this->controller->modelClass}->_schema[$key]) > && !empty($value)){ > > switch($this->controller->{$this->controller->modelClass}->_schema[$key]['type']){ > case "string": > $conditions[$this->controller->modelClass . "." .$key . " LIKE"] = > "%".trim($value)."%"; > break; > case "integer": > $conditions[$this->controller->modelClass . "." .$key] = $value; > break; > case "date": > if(isset($this->controller->params['named'][$key."_fromdate"])){ > $from = date("Y-m-d", strtotime( > $this->controller->params['named'][$key."_fromdate"] )); > $conditions[$this->controller->modelClass.".".$key." >="] = > trim($from); > } > if(isset($this->controller->params['named'][$key."_todate"])){ > $to = date("Y-m-d", strtotime($this->params['named'][$key."_todate"])); > $conditions[$this->controller->modelClass.".".$key." <="] = $to; > } > } > } > } > return $conditions; > > } > > } > ?> > > and in my index view i am using this code > > > element('SearchForm/set_pagination_named');?>//set > pagination named element > element('SearchForm/form') ?>//search form element > > > > > Paginator->sort('id');?> > > > > $i = 0; > foreach ($itSupportRequests as $itSupportRequest): > if ($i++ % 2 == 0) { > } > ?> > > ?> > > > Html->link(__('Edit', true), array('action' => > 'edit', $itSupportRequest['ItSupportRequest']['id'])); ?> > Html->link(__('Delete', true), array('action' => > 'delete', $itSupportRequest['ItSupportRequest']['id']), null, > sprintf(__('Are you sure you want to delete # %s?', true), > $itSupportRequest['ItSupportRequest']['id'])); ?> > > > > > > > > > I have created 2 Elements SearchForm/form.ctp and > SearchForm/set_pagination_named.ctp > > /*form.ctp*/ > > > Search params['controller'] ?> > Form->create(array('action' => 'index', 'type' => > 'GET')); ?> > Form->input('id', array( > 'label'=>'ID','type'=>'text')); > echo $this->Form->submit('Search',array('class'=>'button')); > ?> > > Form->end(); ?> > > > > and here is my set_pagination_named.ctp > > $data_arr=array(); > if(isset($this->params['url']) || isset($this->params['named'])){ > $data=isset($this->params['named'] ) && !empty($this->params['named']) > ? $this->params['named']:$this->params['url']; > $possibledata=array('id');//possible fields > foreach($data as $key=>$value){ > if(in_array($key,$possibledata) && !empty($value)){ > $data_arr[$key]=$data[$key]; > } > } > } > ?> > $this->Paginator->options(array( > 'evalScripts' => true, > 'url'=>$data_arr > )); > ?> > > Thank you in advance. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Cake PHP Search Component not working and giving an error
Hi Bakers I implemented a search component from this url http://www.designaeon.com/cake-php-search-component/ but I have a few problems. At first Cake didn’t recognize the component. After I renamed search.php in SearchComponent.php I got another Error: Declaration of SearchComponent::initialize() should be compatible with Component::initialize(Controller $controller) [APP/Controller/Component/SearchComponent.php, line 40] Below is my code for SearchComponent controller = $controller; } function getConditions(){ $conditions = array(); $data= empty($this->controller->params['named']) ? $this->controller->params['url'] : $this->controller->params['named'] ; $this->controller->{$this->controller->modelClass}->schema(); foreach($data as $key=>$value){ if(isset($this->controller->{$this->controller->modelClass}->_schema[$key]) && !empty($value)){ switch($this->controller->{$this->controller->modelClass}->_schema[$key]['type']){ case "string": $conditions[$this->controller->modelClass . "." .$key . " LIKE"] = "%".trim($value)."%"; break; case "integer": $conditions[$this->controller->modelClass . "." .$key] = $value; break; case "date": if(isset($this->controller->params['named'][$key."_fromdate"])){ $from = date("Y-m-d", strtotime( $this->controller->params['named'][$key."_fromdate"] )); $conditions[$this->controller->modelClass.".".$key." >="] = trim($from); } if(isset($this->controller->params['named'][$key."_todate"])){ $to = date("Y-m-d", strtotime($this->params['named'][$key."_todate"])); $conditions[$this->controller->modelClass.".".$key." <="] = $to; } } } } return $conditions; } } ?> and in my index view i am using this code element('SearchForm/set_pagination_named');?>//set pagination named element element('SearchForm/form') ?>//search form element Paginator->sort('id');?> Html->link(__('Edit', true), array('action' => 'edit', $itSupportRequest['ItSupportRequest']['id'])); ?> Html->link(__('Delete', true), array('action' => 'delete', $itSupportRequest['ItSupportRequest']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $itSupportRequest['ItSupportRequest']['id'])); ?> I have created 2 Elements SearchForm/form.ctp and SearchForm/set_pagination_named.ctp /*form.ctp*/ Search params['controller'] ?> Form->create(array('action' => 'index', 'type' => 'GET')); ?> Form->input('id', array( 'label'=>'ID','type'=>'text')); echo $this->Form->submit('Search',array('class'=>'button')); ?> Form->end(); ?> and here is my set_pagination_named.ctp params['url']) || isset($this->params['named'])){ $data=isset($this->params['named'] ) && !empty($this->params['named']) ? $this->params['named']:$this->params['url']; $possibledata=array('id');//possible fields foreach($data as $key=>$value){ if(in_array($key,$possibledata) && !empty($value)){ $data_arr[$key]=$data[$key]; } } } ?> Paginator->options(array( 'evalScripts' => true, 'url'=>$data_arr )); ?> Thank you in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How do I search all the columns at once?
What have you tried, what sql query does what you want to do? AD On Tuesday, 12 February 2013 05:57:43 UTC+1, Shahruk Khan wrote: > > Say I have column_1 and column_2 for a row. column_1 value is A and > column_2 value is B. My query is A B. How can I perform this kind of search > with CakePHP? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
How do I search all the columns at once?
Say I have column_1 and column_2 for a row. column_1 value is A and column_2 value is B. My query is A B. How can I perform this kind of search with CakePHP? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: search by username or email
not working is a little bit vage.. you should post in more detail what exactly is happening also note, that it usually is better to use array syntax as cake can clean/prepare the sql statements then a little bit better: $scope[] = array('User.' . $field . ' LIKE' => '%' . $filter[$field] . '%'); Am Dienstag, 25. Dezember 2012 03:45:23 UTC+1 schrieb zuha: > > That is some funky looking code there, but you could just use the "OR" > key. Here's an example... > > $this->find('first', array( > 'conditions' => array( > 'OR' => array( >'User.username' => $value, >'User.email' => $value >) > ) > )); > > > On Saturday, December 15, 2012 4:12:13 AM UTC-5, Chris wrote: >> >> hi guys,... I have a admin function that need find users by username or >> email from search field,... and used to work on cake1.2 >> I moved script to 1.3 ,... and it's not working what am I doing >> wrong,... ?? please help >> >> $filter = $this->params['pass']; >> unset($filter['page']); >> unset($filter['sort']); >> unset($filter['direction']); >> $this->data = array('User' => $filter); >> $this->set('url_options', $filter); >> >> $scope = array(); >> foreach(array('username', 'email') as $field) >> { >> if(!empty($filter[$field])) >> $scope[] = 'User.' . $field . ' LIKE \'%' . $filter[$field] . >> '%\''; >> } >> >> thanks in advance >> chris >> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: search by username or email
That is some funky looking code there, but you could just use the "OR" key. Here's an example... $this->find('first', array( 'conditions' => array( 'OR' => array( 'User.username' => $value, 'User.email' => $value ) ) )); On Saturday, December 15, 2012 4:12:13 AM UTC-5, Chris wrote: > > hi guys,... I have a admin function that need find users by username or > email from search field,... and used to work on cake1.2 > I moved script to 1.3 ,... and it's not working what am I doing > wrong,... ?? please help > > $filter = $this->params['pass']; > unset($filter['page']); > unset($filter['sort']); > unset($filter['direction']); > $this->data = array('User' => $filter); > $this->set('url_options', $filter); > > $scope = array(); > foreach(array('username', 'email') as $field) > { > if(!empty($filter[$field])) > $scope[] = 'User.' . $field . ' LIKE \'%' . $filter[$field] . > '%\''; > } > > thanks in advance > chris > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
search by username or email
hi guys,... I have a admin function that need find users by username or email from search field,... and used to work on cake1.2 I moved script to 1.3 ,... and it's not working what am I doing wrong,... ?? please help $filter = $this->params['pass']; unset($filter['page']); unset($filter['sort']); unset($filter['direction']); $this->data = array('User' => $filter); $this->set('url_options', $filter); $scope = array(); foreach(array('username', 'email') as $field) { if(!empty($filter[$field])) $scope[] = 'User.' . $field . ' LIKE \'%' . $filter[$field] . '%\''; } thanks in advance chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: cakedc sample search
LOL... I am reading inline so sorry if I missed the part that made this line... not funny... because that's funny hehehe. Matt On Fri, Oct 5, 2012 at 1:49 AM, AD7six wrote: > Unfortunately, all CakePHP applications require CakePHP. > > AD > > -- > Like Us on FacekBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: cakedc sample search
Vicky, what AD7six is saying (in his own delightful way) is to read carefully what the error message says. It actually describes exactly what the problem is and how to solve it. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: cakedc sample search
Thank u very much. On Friday, 5 October 2012 11:19:53 UTC+5:30, AD7six wrote: > > Unfortunately, all CakePHP applications require CakePHP. > > AD > -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
cakedc sample search
Unfortunately, all CakePHP applications require CakePHP. AD -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
cakedc sample search
I am new to cakephp I got the code from https://github.com/CakeDC/Sample-Search-Application I unziped, and pasted in www folder I am getting the following errors Warning: include(cake\bootstrap.php) [function.include<http://localhost/CakeDC-Sample-Search-Application-a2d2b00/function.include>]: failed to open stream: No such file or directory in C:\wamp\www\CakeDC-Sample-Search-Application-a2d2b00\webroot\index.php on line *76* Warning: include() [function.include<http://localhost/CakeDC-Sample-Search-Application-a2d2b00/function.include>]: Failed opening 'cake\bootstrap.php' for inclusion (include_path='C:\wamp\www;C:\wamp\www\CakeDC-Sample-Search-Application-a2d2b00\;.;C:\php\pear') in C:\wamp\www\CakeDC-Sample-Search-Application-a2d2b00\webroot\index.php on line *76* Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your \cake core directory and your \vendors root directory. in C:\wamp\www\CakeDC-Sample-Search-Application-a2d2b00\webroot\index.php on line *77* -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: radius search zip code in cake php
On Friday, 31 August 2012 16:12:40 UTC+2, Rana Singh wrote: > > Hello guys Please Help Me i want to implement radius search in cake php > but i am not having script ,the script which i have it takes to much time > to find all zipcode with in a mile I recommend: 1) you get the db to do it (google how to do lat long radius queries) 2) you put the query that works for you in a call to $ModelInstance->query(); 3) you use the result AD -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
radius search zip code in cake php
Hello guys Please Help Me i want to implement radius search in cake php but i am not having script ,the script which i have it takes to much time to find all zipcode with in a mile -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.