You are here: Re: objects of MyClass in array? « PHP Programming Language « IT news, forums, messages
Re: objects of MyClass in array?

Posted by Michael Fesser on 01/08/08 07:01

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

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация