Jump to content


  • Posts

  • Joined

  • Last visited

About MrAdam

  • Birthday 07/24/1989

Contact Methods

  • Website URL
  • ICQ

MrAdam's Achievements


Member (2/7)



  1. Hi,I was wondering if anybody knew of any PHP frameworks, specially suited for re-distributable applications? Modern frameworks are very good for splitting the different layers of an application, but they don't strike me as very distributable. I want a good structure and feel to the framework, without quite so much of the bloat and no special requirements to get it running. My application isn't huge, so doesn't need complex routing or multi-application capabilities, etc. Anybody have any to recommend?ThanksAdam
  2. No problem, thanks anyway. I've looked at several different frameworks and they all have their own approach to models, but none seem to be what I'm after. I'll keep digging!
  3. That makes sense, thanks.One other question.. Where would you think is the right place in a typical MVC-based framework to store such objects? For example the project I have in mind at the moment, certain parts of it (employees, clients, etc.) I want to create an Employee, or Client, etc. object to represent them. Obviously straight-forward OO, but where would that make sense in an MVC-based framework?Thanks for your help.Adam
  4. Thanks for your reply.I did think of autoloading the class, but due to the structure of the files I can't see any easy way to do that other than to have it check two directories. Would you say that's acceptable for autoloading? I want it to be as quick and snappy as possible, while keeping a very organised structure. I have the traditional "controller/", "model/" and "view/" directories. Only the "model/" is necessary for autoloading, as the controllers and views are resolved in a different manor.The second directory mentioned is a library of classes that contains the core components of the framework; the DB classes, the base Model, Controller & View, etc. That's already autoloaded in a Zend-like way. Would it be fine performance-wise to include the "model/" directory? Or if not, does another suggestion come to mind?Thanks again for your help..Adam
  5. Hey up everyone,I'm designing my own MVC-based framework. I'm not trying to re-invent the wheel or anything, I just want a simple, custom platform I can build my projects on. I'm implementing some objects (for example User) and creating a factory class (for example UserFactory) that handles constructing the object in various ways. There's an abstract base Factory class that each factory would extend to provide some generic functionality.I'm a little unsure how to structure the factory classes though. Would you say that it's acceptable to have both the User class and UserFactory class within the same file? That way I only need to include User and have UserFactory available. Or do you think it's more appropriate to have them in individual files, and have UserFactory include User?ThanksAdam
  6. Realised a few obvious flaws with the previous XSD. Changed it to: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="products"> <xs:sequence> <xs:element name="product"> <xs:sequence> <xs:complexType> <xs:element name="title" type="xs:string" /> </xs:complexType> </xs:sequence> </xs:element> </xs:sequence> </xs:element></xs:schema> But get the error:
  7. I decided to take things back to basics.With this XML: <?xml version="1.0"?><products> <product> <title>Product A</title> </product></products> And this XSD: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="products"> <xs:complexType> <xs:element name="title" type="xs:string" /> </xs:complexType> </xs:element></xs:schema> I receive the following error: Referring to this line: <xs:element name="title" type="xs:string" /> I feel like I'm missing something fundamental out? :sThanks
  8. Sorry I posted a little prematurely there. I have managed to fix some of the issues, but I still get one: lement '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))) That's using PHP's DOM schema validator. I used an on-line validator and the error is: 4s-elt-invalid-content.1: The content of '#AnonType_products' is invalid. Element 'element' is invalid, misplaced, or occurs too often. Which refers to the line: <xs:element name="product" minOccurs="0" maxOccurs="unbounded"> The XSD in-full is now: <?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="products"> <xs:complexType> <xs:element name="product" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="id" type="xs:integer" /> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="stock"> <xs:complexType> <xs:sequence> <xs:element name="available" type="xs:integer" /> <xs:element name="ordered" type="xs:integer" /> <xs:element name="delivery" type="xs:date" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="stats"> <xs:complexType> <xs:sequence> <xs:element name="total_sold" type="xs:integer" /> <xs:element name="per_order_average" type="xs:decimal" minOccurs="0" /> <xs:element name="all_order_average" type="xs:decimal" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:complexType> </xs:element></xs:schema> Again.. very grateful for any help. Just need a push in the right direction..Thanks
  9. Hi guys,Managed to get some-what comfortable with XSLT now, but looking to validate my XML against my schema. I'm working with the following, pretty-simple XML: <products> <product id="1"> <title>Product A</title> <stock> <available>123</available> <ordered>123</ordered> <delivery>01/01/1970</delivery> </stock> <stats> <total_sold>123</total_sold> <per_order_average>123.45</per_order_average> <all_order_average>123.45</all_order_average> </stats> </product></products> My schema is: <?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="products"> <xs:complexType> <xs:element name="product"> <xs:attribute name="id" type="xs:integer" /> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="stock" /> <xs:complexType> <xs:sequence> <xs:element name="available" type="xs:integer" /> <xs:element name="ordered" type="xs:integer" /> <xs:element name="delivery" type="xs:date" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="stats" /> <xs:complexType> <xs:sequence> <xs:element name="total_sold" type="xs:integer" /> <xs:element name="per_order_average" type="xs:decimal" /> <xs:element name="all_order_average" type="xs:decimal" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:complexType></xs:element> I'm getting a lot of errors though. Am I on the right track? One area I can't seem to find a clear explanation of is attributes, with a complex type within them.In my XML above I have: <product id="1"> [...]</product> Which I'm using the following schema to validate: <xs:element name="product"> <xs:attribute name="id" type="xs:integer" /> <xs:complexType> [...] </xs:complexType> </xs:element> But I don't think that's correct. Any pointers or advise would be greatly appreciated!ThanksAdam
  10. Thanks for your response. I'm using PHP's XSLTProcessor class. I solved the issue by using the unicode " " white-space character.Thanks again for your help.
  11. Sorted, cheers. I switched it to "xml" and omitted the opening XML tag. I just have one more question though...I have some XHTML like: <h3><span>#1</span> Product Title</h3> Where "1" and "Product Title" are replaced by the XML value. That's all fine, but when it's processed the space between the closing span tag and the start of the title text is stripped out. So the result looks like: I came across the "xml:space" attribute:<h3 xml:space="preserve"> This works works visually, but oddly it's still shown within the source afterwards..?Thanks for all your help.
  12. Hey up again,Quite comfortable with XSLT now, but have a puzzling problem. In my <xsl:output ... /> tag, I'm specifying the 'doctype-public' and 'doctype-system' attributes as the correct values for XHTML Strict 1.0: <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" /> However when I view the source code of the web page, the mark-up is HTML with an XHTML DOCTYPE? Also nothing is indented, like I'd expect to see with indent="yes"?Any help or advise would be greatly appreciated!Thanks
  13. Once again steered me right! Cheers for that.
  14. Hey up,Is it possible to kind of modularise XSLT templates, by including other external templates into them? I tried to look for something like this on Google but couldn't find anything...Thanks
  15. Brilliant, thank you. I'm actually really enjoying learning it. It's been something I've meant to try for a long time, and now I'm glad I did.Thanks again.
  • Create New...