hi xhenxhe

personnally, as it's a component needed all the time, I'd put this
line in /cake/app_controller.php :
var $components = array('YourComponent');
then all you need is :
<? echo $this->renderElement('name of the element') ?>
somewhere in your default.thtml

at least that's what I did with the othAuth component (which I need
all the time too), together with an othAuth element I wrote, which
displays the current user and/or links to add user, login, logout,
etc, and which is rendered in my default layout too.

I'm not quite an expert with cake now, so please correct me if I'm wrong.

++++++
clemos

On 6/9/06, xhenxhe <[EMAIL PROTECTED]> wrote:
>
> OK, I've just written a component, how do I include that in my default
> layout view?
>
> Thanks clemos!
>
> Dustin
>
> clemos wrote:
> > hi xhendhe
> >
> >
> > If I were you, I'd probably do a Component more or less like in the
> > blog tutorial from the wiki :
> > http://wiki.cakephp.org/tutorials:blog_tutorial_-_2
> >
> > then your "random()" method - which takes a random banner (probably by
> > doing a findAll query with order "RAND()" and limit 1) and outputs it
> > to a variable available for your Element - will be in your
> > Controller...
> >
> > I hope this helps.
> >
> > +++++++
> > clemos
> >
> > On 6/9/06, xhenxhe <[EMAIL PROTECTED]> wrote:
> > >
> > > I want to rotate banner code in my default.thtml layout file. Basically
> > > I have a table in my db as such:
> > >
> > > id
> > > title
> > > banner_code
> > >
> > > My template file has the following snippet:
> > >
> > > <div id="banner_code"><?=$banner_code?></div>
> > >
> > > I know the "old" php method of writing a function to query the db and
> > > get a random code snippet from the database, but what is the best way
> > > to do it with cake? Where do I even put the function for this?
> > >
> > > Thanks,
> > > Dustin
> > >
> > >
> > > >
> > >
>
>
> >
>

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

Reply via email to