|
Posted by Steve on 01/08/08 14:06
"Michael Fesser" <netizen@gmx.de> wrote in message
news:a676o3tif3o2rsja45dlc10dphncslb24m@4ax.com...
> .oO(Steve)
>
>>yes, that's what i meant. as it is though, i haven't really had a need to
>>implement an interator on a custom class in php. arrays work fine for just
>>about everything in php. i did, however, enjoy reading the article you
>>referenced about doing just that - custom classes implementing iterators.
>
> I find it quite useful. In my own framework for example I have a class
> TSitemap that holds a representation of all the documents on a website.
> It contains a tree-like structure of simple page objects, which store
> the name, title, URL path, description, access permissions etc. for
> nearly every page. This sitemap is mainly used to automatically generate
> nav bars (main menu, sub menus, breadcrumbs etc.) and such things, but
> from time to time it's also necessary to directly access a particular
> page object from the tree or to iterate over all pages, regardless of
> their relation to other pages. To achieve this I simply implement the
> ArrayAccess and Iterator interfaces in the TSitemap class.
hmmm...hadn't thought of doing that. do you build that from a db each time a
page is visited or do you build it once and then put it into a session?
[Back to original message]
|