Thank you for asnwering!

I think I'm close to make it work, but I'm havent been able yet... I
followed the instructions of the article and what I have is:

1) A database table called "fields"(it's strange, but fields is the
real name of the table :S), whose fields are
id   fieldname content

2) In my Field model
class Field extends AppModel {
    var $name = 'Article';
    var $actsAs = array('Sluggable' => array('separator' => '_',
'overwrite' => true, 'slug'=>'id', 'label'=>'fieldname'));  ;
}

3) In my Fields Controller:
function view($slug) {
        $field= $this->Field->findBySlug($slug);

        $this->set('field', $field);
}

4) The link to see a field is like that:
echo $html->link($temp_field['Field']['fieldname'],array
('controller'=>'fields','action'=>'view',$temp_field['Field']['id']));

Previously, I put the sluggable.php file in the app/models/behaviors
folder. What I'm missing or doing wrong??

Thank you very much again.

Regards!






On 5 mar, 02:38, Sam Sherlock <[email protected]> wrote:
> have a look athttp://bakery.cakephp.org/articles/view/sluggable-behavior
>
> 2009/3/5 park <[email protected]>
>
>
>
> > You either define a '/fields/view/science' route (hard coded) in /app/
> > config/route.php,
> > Or pass 'science' as an argument an do a query in db.
>
> > On Mar 5, 8:23 am, MaNuM <[email protected]> wrote:
> > > Hi everybody. I haven't worked for a long time with CakePHP and I
> > > can't find a solution for this:
>
> > > In my application a I have now url's like this one:
>
> > >http://localhost/cake/ocwdev/fields/view/17
>
> > > 17 is the id refered to a field called "Science" for example. I would
> > > like the url to be like this one:
>
> > >http://localhost/cake/ocwdev/fields/view/Science
>
> > > Is this possible without passing "Science" as an argument? I think it
> > > is not a good idea to search by 'name' instead of by 'id' in the
> > > controller to see the contents of the field..
>
> > > Thank's in advanced.
>
> > > Regards.

--~--~---------~--~----~------------~-------~--~----~
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