SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru rockit's Avatar
    Join Date
    Sep 2005
    Location
    Canada
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML + PHP Driven eCommerce Planning

    just would like some feedback from readers on what they feel would be a good pattern to code an XML site along with PHP maybe with some MySQL assistance.

    the product catalogue i'm working on will consist of a hierarchy of something like a Department>Category>Product. i was wondering if there's a way to maybe just do all this in xml? to maybe cutback on the amount of database queries. or, should i just stick to the traditional approach of just doing the site strictly with PHP & MySQL?

    any feedback regarding possible links to great articles, tutorials, or books would be of great assistance. PS: pretty much have all the sitepoint books related to PHP, MySQL, XML & DHTML.

    Thanks Folks.

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML databases exists, but I don't think you want to go there.

    For storing hierarichal data in a RDBMS, you should look at some of the tree-algorithms. In particular the modified preorder tree-traversal. There's an excellent article here at sitepoint about it (and with php+mysql code examples).

    It doesn't sound from your description though, that your catalog is indeed hierarichal. Rather there is a difference between the model data and the view data. Eg. for the user it may appear that data is hierarichal, but you actually have a limited number of levels, and each level is actually an attribute of the commodities in the catalog. Hierarchies are more for when you have an unlimited number of levels, and when the types can be intermixed within this hierarchy.

  3. #3
    SitePoint Guru rockit's Avatar
    Join Date
    Sep 2005
    Location
    Canada
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the assistance. i am wondering from your perspective, what do you recommend XML for in regards to web development with PHP. i'm currently reading sitepoint's XML web development with PHP. thought i'd get creative and see what i can come up with.

    thanks again.

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML is very useful for exchanging data, especially over network and/or between different platforms, or different languages, or even different programs. This makes webservices a very good candidate for XML.

    Additionally, HTML may be expressed as XML (~XHTML). This makes XML and it's technologies a good choice in the view-layer. It could simply be used as a templating-system, but you could also do a two-step view, where your model-layer outputs some intermediate XML-model, which is then further transformed into the final view by means of Xpath and XSLT.
    I don't know how many people actually do this with PHP, and I'm under the impression that there may be performance-problems. I don't think it's a show-stopper though.

    Using XML in the model-layer is not really practical, IMHO. If you are to have any larger amounts of data, you'll have to use a XML-database or you'll suffer from performance. Theese exists, but they are certainly not standard, so you'll have to have access to your own server. If you are feeling curious, I know that Xindice is fairly easy to get running, and since it has an XML-RPC interface, it's quite easy to integrate with PHP.
    You could also look into Berkeley DB XML.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •