>From what I can see you will need a helper that has access to the smiley model.
You can do so with: loadModel('smiley'); class SmileyHelper extends Helper{ var $Smiley = new Smiley(); } And then you can use it like $this->Smiley->find('ascii_code'=>';)'); Creating the regex find and replace is up to you. Geoff -- http://lemoncake.wordpress.com On Jul 10, 6:18 am, DrLaban <[EMAIL PROTECTED]> wrote: > Hello there! > > I'm at the moment trying to figure out how to fit a new model into the > existing controller. As I mentioned earlier I did manage to create a > relation between Avatars and Guestbooks, since it had the elements > required to create such a relation in Cake's framework. > > Now, the tricky thing I have yet to grasp (I'm reading the replies > here while I trial and error a bit), is how to make the combine of the > guestbook controller or its views to be able to get to the information > stored in the model. > I'm of the impression that I can't get to the data information stored > in the model without shipping it into a controller first. > I need to combine the Smileys information with the rest of the > guestbook in order to translate an ASCII ":)" into an img-tag. > > I have an ERD that you can look at and as you can see there is no > database relation between the Guestbooks and Smileys, but there will > be a relation in the application (where the message text from the > Guestbooks table will be parsed to replace ASCII smileys into img- > tags).http://www.jhe.nu/upload/erd.jpg > > I'm sorry if I'm a bit slow in the understanding here, but programming > like this in PHP is totally new for me. But I appreciate you taking > your time to try and help me out! > > Regards > DrLaban > > On Jul 7, 1:28 am, Grant Cox <[EMAIL PROTECTED]> wrote: > > > If you don't want to hard code them in your helper, then you will need > > another database table for your smileys. And a model. > > > Now you can get/set the database data just like any other model, > > through $this->Smiley->find() and $this->Smiley->save(). To get a > > list you might want to use $this->Smiley->generateList(). > > > Now, how does Smiley relate to other models? I would have guessed > > that the HTML code for a smiley is to be added to a textarea (ie in > > your GuestBook post?) but after this point there is no dynamic > > relationship. In which case there are no associations. Or perhaps a > > single Smiley has to be chosen for the Guestbook post icon - in which > > case you want a GuestBook belongsTo Smiley association (with > > GuestBook.smiley_id). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---