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