php class structure
View Single Post
02-20-2009, 10:52 AM
Join Date: Nov 2007
Location: France, near Paris
To me, I would design it like that:
- A class WordDocument
|_ collection of 'Page'
- A class Page
|_ collection of 'Paragraph'
|_ header (instance of 'Paragraph')
|_ footer (instance of 'Paragraph')
- A class Paragraph
|_ adaptation (left, right, centered, justified)
- A class Image
Headers and footers are nothing but a paragraphs so no need to create those classes. Find just a way to store in your WordDocument the information about "are the headers and the footers the same for all pages or are they differents for the first one ?". In the 'Page' constructor, if a header and/or a footer have already been created, just think to add to the 'header' and/or the 'footer' attributes a reference to those created.
The WordDocument class has a collection of class Page so typically, an array of instances of class 'Page'.
The Paragraph class could contain text and images but no need to create the class Text. What methods could exist in a such class ?
mmmm I don't see anything more.
Someone correct me if I'm wrong
Wedus project's Website
View Public Profile
Send a private message to Gibou
Visit Gibou's homepage!
Find More Posts by Gibou