You're almost right.
You'll have to make your controller return the data when you request the
data.
E.g.
if(isset($this->params['requested'])) {
return $data;
}
And in your view:
$data = $this->requestAction('/sdts/singled_T);
//view code
Please check this article,
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestactionto
see a great explanation about how to do this.
Good luck,
--
Matias Lespiau
http://www.gignus.com/
On Feb 3, 2008 4:12 PM, tomoenage <[EMAIL PROTECTED]> wrote:
>
> Hey,
>
> I'm trying to construct an element, which contains information from a
> database. This element should be used in default.thmtl.
> The databes holds a value describing a "single of the day", i wrote a
> model for that, i wrote a controller and i wrote a view . Everythings
> perfect, the view shows the expected value from the database.
> For constructing an element I moved the view-Code from app/views/sdts/
> singled_T.thtml to app/views/ELEMENTS/singled_T.thtml and inserted
> $this->renderElement ('singled_T'); into default.thtml.
> As long as I look on views in sdts everything is fine, but when i
> change to another view (example localhost/user instead of localhost/
> sdt), i get the message, that the variable in line 2 of the element
> singled_T.thmtl is undefined.
>
> I tried to add an $this->requestAction('/sdts/singled_T) but the only
> effect is an dead apache.... Maybe that constructs a recursion?
>
> I'm shure, that can't be a big problem, but I have no idea to
> test....
> Anybody able (and willing) to help me?
>
> Thanks a lot
> Pit
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---