Done in the following way:

1-In model, created function NameToUrl where special characters and spaces
are stripped.
2-In TABLE, added field urlName
3-In controller, methods Save and Edit, after validation, added the
following line:


$this->data['Video']['urlName'] =
$this->Video->NameToUrl($this->data['Video']['track_title']);

And it works great.

Thanks for your time.



Anyway, I was wondering where I must put my custom functions in CakePHP to
be available through the entire app.

See ya!





On Tue, May 6, 2008 at 2:03 PM, Nicolás Andrade <
[EMAIL PROTECTED]> wrote:

> No, I did not. I did not even know about it; so I'll look for it and tell
> you what I've found.
>
>
> Thanks!!
>
> n.
>
>
> On Tue, May 6, 2008 at 2:01 PM, francky06l <[EMAIL PROTECTED]> wrote:
>
>>
>> Did you try the inflector class ? inflector::humanize, or
>> inflector::underscore  . Just a hint..
>>
>> hth
>>
>> On May 6, 6:52 pm, "Nicolás Andrade"
>> <[EMAIL PROTECTED]> wrote:
>> > Hi, I'm working in a project where are shown artists and songs.
>> >
>> > The following URL shows artist info and links to different videos, using
>> > Routes:
>> >
>> > http://videos.dev/artist/jamiroquai/
>> >
>> > What I did is define the route to searchByArtistName() and then I search
>> > using name field.
>> >
>> > Problem comes with, ie, "Rage Against The Machine", or worse than that,
>> > "Guns 'n roses"
>> >
>> > I need to create /artist/rage_against_the_machine/ and
>> > /artist/guns__n_roses/ for example.
>> >
>> > So would be nice to have a function UrlToName and NameToUrl where I can
>> code
>> > the String Replacements.
>> >
>> > Finally, the question:
>> >
>> > Where it must be, to be available in most of Controllers and Models and
>> so
>> > on, in a CakePHP way?
>> >
>> > Thanks in advance!
>> >
>> > n.
>> >>
>>
>
>
> --
> Nicolás Andrade
> www.nicoandra.com.ar
> www.treintaguita.com.ar




-- 
Nicolás Andrade
www.nicoandra.com.ar
www.treintaguita.com.ar

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