Saturday, March 5, 2011

Re: how to all a function from a controller action

thank you very much!


On 4 Mrz., 19:01, cricket <zijn.digi...@gmail.com> wrote:
> On Fri, Mar 4, 2011 at 11:24 AM, martin <mschenk....@gmail.com> wrote:
> > hi
> > i'm new to cakephp, but i know about php.
> > i didn't get the mvc concept 100% up to now, sorry.
>
> > where do i have to place a function which i want to call from inside
> > an action of a controller?
> > i have an import action in the pages controller
> > and need to call several times my oen function convertdate() from
> > inside the action import.
>
> > do i have to resolve that with a component? or in a model?
> > where and how do i have to place this function please and how do i
> > have to call the function from inside my controller action "import"?
>
> You should probably put it inside a model. If it's not specific to a
> single model, put it in AppModel. Then call it like so:
>
> $this->YourModel->yourMethod()
>
> But if it's not really something that should belong to a model (eg. a
> generic utility function) put in bootstrap.php and call it like a
> normal function.
>
> > i also would apreciate links to tutorials, where i can undertand with
> > examples, how to create own  behaviors, components and helpers. i was
> > reading the cakebook, but o would prefer more concrete examples.
>
> I continue to learn quite a bit from Teknoid's site. Also, the Bakery,
> but there's quite a bit of code that's questionable, too. Check the
> comments, always.
>
> And, no matter what you're looking at online, pay close attention to
> the date it was posted and any version numbers mentioned. Cake has
> gone through some big API changes.
>
> http://nuts-and-bolts-of-cakephp.com/http://bakery.cakephp.org/

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: