[dev] Ansel_Gallery
Chuck Hagenbuch
chuck at horde.org
Thu May 17 17:44:28 UTC 2007
Quoting Michael Rubinsky <mike at theupstairsroom.com>:
> Now that subgalleries are displayed along with images, I've been
> toying with the idea of changing some things about Ansel_Gallery
> class. For one, I think it makes sense, if it's possible, to add
> something like Ansel_Gallery::getChildren countChildren,
> listChildren etc... instead of getImages etc...so we can
> encapsulate more of the functionality into the gallery object.
Sounds okay to me.
> I've really just started playing with moving some stuff around, and
> don't know for sure if it will work. I can't figure out the best
> way to deal with the fact that we will basically be returning a
> mixed array or both Ansel_Image and Ansel_Gallery objects. I don't
> like the thought of a bunch of if (is_a($child, 'Ansel_Gallery'))
> etc... but no matter what design I try, I've not been able to get
> past the fact that at some point we *will* need to know if an image
> or gallery...at least not without putting some sort of HTML
> generating methods into the objects.
If the HTML generation is what you need it for, just add something
like a getView() method to the objects that returns the appropriate
Horde_View object; the html will be encapsulated in the templates for
the view.
Actually don't really use Horde_View since that's a Horde 4/PHP 5
thing, but the concept applies.
-chuck
More information about the dev
mailing list