You said in your previous post that you are having an index error User not
found... right?

Honestly, I haven't tried using the searchable behaviour...but try adding
(below) in your function search action.

$users = $this->Translate->User->find('all');
$this->set('user', $users);

and do the foreach loop in your search.ctp.


On Sat, Feb 21, 2009 at 4:21 PM, amarradi <[email protected]> wrote:

>
> Thanks for the help
>
> here my models
>  First the User
>
> <?php
> class User extends AppModel {
>        var $name = 'User';
>    var $hasMany = array('Translate');
>        var $validate = array(
>                'username' => array('notempty'),
>
>                'password' => array(
>            'rule' => array('between', 6,64),
>            'message' => 'Ihr Passwort muss mindestens 6 und darf
> höchstens 64 Zeichen lang sein.',
>            'required' => true
>            ),
>        'retry' => array(
>            'rule' => array('between', 6,64),
>            'message' => 'Ihr Passwort muss mindestens 6 und darf
> höchstens 64 Zeichen lang sein.',
>            'required' => true
>            ),
>        );
>
> }
> ?>
>
> <?php
> class Translate extends AppModel {
>    var $name = 'Translate';
>    var $actsAs = array ('Searchable');
>    var $belongsTo = array('User');
>    var $validate = array(
>        'language1'=>array(
>            'rule'=> array('minLength', 1),
>            'message' => 'Bitte geben Sie das schweizer-deutsche Wort
> ein.'
>        ),
>        'language2'=> array(
>            'rule'=> array('minLength', 1),
>            'message' => 'Bitte geben Sie das deutsche Wort ein.'
>                    ),
>        'q'=>array (
>            'rule'=>array('minLength', 1),
>            'message' => 'Bitte geben Sie ein Suchwort ein.'
>            )
>        );
> }
> ?>
>
>
> My view Translate Controller ....
>
> There is no view Controller, because i use the searchable_behaviors
> from cakePHP so i bringt the results based on in the browser
>
>  function search(){
>
>
>        $this->set('rowCount',$this->Translate->find('count'));
> //        $this->Session->setFlash();
>
>        $this->set('results',$this->Translate->search($this->data
> ['Translate']['q']));
>        $results=$this->Translate->search($this->data['Translate']
> ['q']);
>        if (!empty($this->data['Translate']['q']) && empty($results))
>        {
>            $this->Session->setFlash("Diese Übersetzung gibt es noch
> nicht.");
>            $this->redirect(array
> ('controller'=>'Translates','action'=>'add'), null, true);
>        }
>        else
>        {
>           $this->set('results', $results);
> //           $this->Session->setFlash("Test: ".$this->data['Translate']
> ['q']);
>
>        }
>    }
>
> The searchable_behaviors runs normally :) (after long testing an
> configurationperiod)
>
> with the $results i go on the search.ctp und the foreach loop
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to