Hi all,
first of all I must say cakePHP is amazing how everything works
automagically. :-) (I'm still learning but once I've learned enough, I'll
be happy to help others.)
Now I'm wondering about *best practice for a CAROUSEL - basically a piece
of website with rotating images*
. Let's say I want to:
--- a carousel that can display different models and entries from the
database (e.g. "latest 3 articles", "top 5 players", "top 3 most active
teams")
--- this carousel should be reusable and universal
(I don't care about the javascript, I already have that)
How would you do it? My idea is:
--- create an element (carousel.ctp in View/Elements)
--- allow to pass some parameters to the carousel element
--- include this element in different views with different parameters
--- the element would then loop through the parameters and display
something according to them
So for example:
In one view:
> $this->element('carousel',
> array(
> 'model' => "articles",
> 'limit' => 3,
> 'order' => "created DESC"
> )
> );
>
In another view:
> $this->element('carousel',
> array(
> 'model' => "users",
> 'limit' => 5,
> 'order' => "rating DESC"
> )
> );
*My question is --- should the carousel element really do the work (e.g.
getting last 3 articles)?*
*Shouldn't that be in some controller --- and if yes what one (I want to
avoid any duplicities)*
Thanks a lot!
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.