I'm confused about this issue.
I had assumed having Models referenced directly in presentation
related code was bad practice - but isn't that the Cake 1.2 way of
doing form inputs? It seems to make for cleaner and simpler code that
way...

tompouce, is there a chance your new problems are caused by the lazy
loading feature, introduced not too long ago?

The post  "Component can't create a model" discusses similar
issues,and mentions the loadModel function...

http://groups.google.com/group/cake-php/browse_thread/thread/71d9021c27f32419/8a6d98c57a59609f?lnk=gst&q=create+model&rnum=3&hl=en#8a6d98c57a59609f








On Feb 20, 2:45 pm, tompouce <[EMAIL PROTECTED]> wrote:
> Yeah but, I want just to include an element that will get my blocks for my
> sidebar from the database Blocks without any thing more than a model, like i
> used to do...
>
> is there a good simple way to this?
>
> Thanks!
>
>
>
> AD7six wrote:
>
> > On Feb 20, 5:29 am, tompouce <[EMAIL PROTECTED]> wrote:
> >> Hi!
>
> >> A year ago I coded an app with cakephp, and in my elements
> >> I was using this syntax:
>
> >> $bleh = new Modelname;
>
> >> for using stuff from the dabatase Modelnames.
>
> >> But now its not working anymore because I must be missing something, any
> >> ideas?
>
> >> Like if i want to include a sidebar to a website.
>
> >> I include the element Sidebar who get the Bloc from the database Blocs.
>
> >> like $Sidebar = new Blocs;
>
> >> foreach ($Blocs as $Bloc): etc...
>
> >> Thanks!
> >> --
> >> View this message in
> >> context:http://www.nabble.com/using-models-in-elements-tf3256640.html#a9054292
> >> Sent from the CakePHP mailing list archive at Nabble.com.
>
> > Hi Tom,
>
> > There is a way to instanciate a model wherever you need it, but you
> > should /never/ do that in a view/layout/element. My suggestion would
> > be to add var $uses = array('Bloc') to your app controller and put the
> > logic you want in the beforeRender method (but be aware that for a
> > cake error message an instance of the app controller is used and no
> > models are loaded). There are other ways, but explaining them might
> > encourage you to leave the model stuff in the element, which I don't
> > want to do :)
>
> > HTH,
>
> > AD
>
> --
> View this message in 
> context:http://www.nabble.com/using-models-in-elements-tf3256640.html#a9063042
> Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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