SitePoint Sponsor

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 25 of 100
  1. #1
    ********* Articles ArticleBot's Avatar
    Join Date
    Apr 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Discussion thread for Build an XML-Based Content Management System with PHP

    This is a dedicated thread for discussing the SitePoint article 'Build an XML-Based Content Management System with PHP'

  2. #2
    Anonymous
    SitePoint Community Guest
    Nice introductionary article. Could use some info on non-text data inclusion in XML though (such as pictures).

    What about using XSLT for some templating (instead of hardcoded layout in .php code files). I thought using XML/XSLT was a nice way to do code/content separation?

    Could someone comment on the pros/cons of XML based vs. database-based CMS? Is it only a performance vs. interchangability/portability issue, or is there more behind it all?

  3. #3
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    funnily enough, i was playing with something similar the other day - but then gave up when i found out the client's hosting company had already set up a database for that domain (and yes, i stuck with what i knew and went for a db-driven solution rather than an XML file based one).
    good article though, and very interesting to read about domxml (which i thought at this stage was still an experimental implementation in php ?)
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've used XML template seperation before to a great deal... ie I replace given xml well formed tags in the XML document with data dynamically generated via PHP and transformed with XSL stylesheet via Sablotron.

    Although this works and it is an easy and convienent a number of forum member's have pointed out that this method is slower than using the DOM for example, or SAX.

    I have therefore thought about now using the DOM to dynamically create the complete page now... but this idea does work so if you want to continue with it; go for it

  5. #5
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I like this article. My only complaint is that it relies on an experimential function of PHP, DOM XML, which doesn't work on my host and has different function names on two other sites I tried it on. Otherwise, a very cool concept that I'd like to explore more.
    Chrispian H. Burks
    Nothing To Say

  6. #6
    public static void brain Gybbyl's Avatar
    Join Date
    Jun 2002
    Location
    Montana, USA
    Posts
    647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you really want to try it out, just set up Apache/PHP on your own computer -- It might not be worth it, but at least you will get to see it working.

    =]
    Ryan

  7. #7
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gybbyl
    If you really want to try it out, just set up Apache/PHP on your own computer -- It might not be worth it, but at least you will get to see it working.

    =]

    My dev box already has it setup and it works fine there. I was just pointing out that I didn't like the use of an experimental function. There's nothing wrong with it, but I don't think a tutorial should use something that's not stable or likely to change. It's a very *minor* issue I had with the tutorial.
    Chrispian H. Burks
    Nothing To Say

  8. #8
    SitePoint Member codergurl's Avatar
    Join Date
    Jun 2003
    Location
    Houston, Tx, USA
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How is this way better?

  9. #9
    SitePoint Member ImCat's Avatar
    Join Date
    May 2003
    Location
    Vilnius, Lithuania
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I did not go much into the code, but
    what scares me is '<font color=red>' -- and thats is being used in the article about XML... OK, you may not choose to use
    XHML in your article (but I think it would fit perfectly with the title), but using deprecated tags (not to mention unquoted attributes, but it is not required in HTML)-- well, what do I know...
    And that's under "Fresh thinking".

  10. #10
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Anonymous
    Could someone comment on the pros/cons of XML based vs. database-based CMS? Is it only a performance vs. interchangability/portability issue, or is there more behind it all?
    This is my biggest problem with this article: there are no advantages to using XML in this way. The XML design presented could be replicated exactly using a database, and would result in less code, higher performance and better searching abilities. XML is great for interoperability, but with a custom database app you can knock up a bit of PHP to export the data as XML without needing to store it as XML internally.

    Where XML comes in to its own in the field of content management is marking up actual content (paragraphs, headers, lists and so forth - the kind of thing XHTML does). You can then store the XML in a field in the database, but use other database fields for things like the ID, title, keywords and so on.

    That said, the article does provide a useful introduction to PHP's DOM extension and methods for handling XML. I would thoroughly recommend against using these techniques for a CMS if you have the option of using a database instead of (or as well as) the filesystem. In fact, sicne the filesystem is being used in this case a more efficient (not to mention easier) approach would be to use serialized PHP objects instead of XML files. That would eliminate most of the code in the tutorial, as all of the XML encoding and decoding parts could be replaced with a single call to serialize() or unserialize().

  11. #11
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very good article. Makes more sense than much of the other XML articles I have read.

    Aaron

  12. #12
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Sketch. A very easy to understand tutorial... Definately gave me some ideas on how to work proceed with my CMS work!

    I didn't know XML was that easy.

  13. #13
    SitePoint Member scratch's Avatar
    Join Date
    Jul 2003
    Location
    Belgium
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice introductionary article. Could use some info on non-text data inclusion in XML though (such as pictures).

    What about using XSLT for some templating (instead of hardcoded layout in .php code files). I thought using XML/XSLT was a nice way to do code/content separation?

    Could someone comment on the pros/cons of XML based vs. database-based CMS? Is it only a performance vs. interchangability/portability issue, or is there more behind it all?

  14. #14
    Anonymous
    SitePoint Community Guest
    Is this system search engine friendly, in other words, no "?" in the URLs?

  15. #15
    Anonymous
    SitePoint Community Guest
    It would had been much much much easier if you would have developed the CMS using a database. You have failed to explain WHY should someone prefer XML over a database. Suppose if i have 100000 articles, can you imagine how much time your stupid XML will take in searching as compared to a database? then Why XML? Just because its a buzz word?

  16. #16
    Anonymous
    SitePoint Community Guest
    It would be nice to have screenshots of the pages posted in the article as not everyone is reading the article to implement the idea.

  17. #17
    SitePoint Zealot prefab's Avatar
    Join Date
    Jan 2003
    Location
    Belgium
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Anonymous
    Is this system search engine friendly, in other words, no "?" in the URLs?
    If you are refering to my system, yes it is...it's nicely oriented around 'human readable urls'...It's not even dependant on mod_rewrite...

    Quote Originally Posted by Anonymous
    It would had been much much much easier if you would have developed the CMS using a database. You have failed to explain WHY should someone prefer XML over a database. Suppose if i have 100000 articles, can you imagine how much time your stupid XML will take in searching as compared to a database? then Why XML? Just because its a buzz word?
    Don't you just love anonymous posts?

    Don't even know I you were targetting me here...but here goes...

    imho I think I did a good job of explaining pros and cons...
    I AM aware of limitations...I never meant it to handle 100000 articles anyway...my clients don't need that, besides, if they were I WOULD definately use a database. For now I can port my current system within a day or so, and implement some simple datastructures for which a database would simply be overkill.
    Things like e-mail addresses and links archive of the usual business oriented site don't NEED a database per se, the DO NEED separation of presentation...something XML can offer of you're open to thinking out of the box...

    In fact, I think the PHP/MySQL combo, while extremely powerful, has a lot of people numbed in thinking it is the only way to handle things. I agree, in most cases it is, but in a lot of cases some creativity can do wonders...

    So...
    Quote Originally Posted by Anonymous
    Just because its a buzz word?
    I guess PHP/MySQL is a buzzword too...

  18. #18
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Toronto, Canada
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Anonymous
    It would had been much much much easier if you would have developed the CMS using a database. You have failed to explain WHY should someone prefer XML over a database. Suppose if i have 100000 articles, can you imagine how much time your stupid XML will take in searching as compared to a database? then Why XML? Just because its a buzz word?
    It's words like this that really upset me... Why on earth is this a "stupid" solution?!

    For some users it meets their needs perfectly. Not everyone has access to a database, so for those who have low overhead (minimal article repository), this solution is perfect.

    Ignorance is a b*tch, isn't it?

    Btw, nice article... It certainly opened up my eyes on realizing that for small systems of this size, this solution is definately a viable one!
    ...Shakes


    "Whether you think you can, or you think you can't, you're right!"

  19. #19
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    on topic again...
    does anyone can tell me what i've to do to get the dom working?
    note: got no answer from my previous post

  20. #20
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rfl,

    What version of DOMXML are you using on your server? Is it your own server, or are you testing it out on your host's machine?

  21. #21
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm testingit in my machine; i've php 4.3.1
    when i uncoment the extension=php_domxml.dll in my php.ini and restart apache, i get a message saying unable to find this extension, but i checked it and the dll is there...

  22. #22
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you running PHP/Apache on a Windows or Unix box?

    If you're on Windows... make sure you have the latest version installed. You can download DOMXML if you don't have the latest version.

    Let me know if that does the trick...

  23. #23
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've windows XP pro, apache 2, php 4.3.1 and mysql 2;
    the domxml i've is called php_domxml.dll as the one you recomended.What do i do?

  24. #24
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have to say I'm slightly disappointed by the article. From the title it sounded quite good, so I gave the code examples a shot and tried to get the CMS described in the article running. I'll try and sum those issues I had with the article.

    -----
    1. register_globals = on needed.
    This was AFAICS nowhere mentioned, instead the author recommended to use a PHP version >= 4.21 because of the DOMXML support. That's somehow ironic, because since PHP 4.2 register_globals is turned off in the default configuration file. Anyway, using extract() at the top of each script helped.

    2. No validation of user input
    Actually, both the createArticle.php and deleteArticle.php scripts allow you to create/delete articles somewhere different than the ./xml folder originally destinated to hold the article file. At least it would have been nice to mention this little fact, so someone adopting the code for a live system doesn't necessarily have a bad surprise.
    There are a lot of other occasions were it is neglected to check incoming variables, whether they do exist at all or contain ambigous data.

    3. Various erros
    In the index.php file, the name of the input field is wrong. Change this line:

    Code:
    <input name="search" type="text" id="search">
    to

    Code:
    <input name="searchTerm" type="text" id="searchTerm">
    so that the search functionality does work. Also, the regexp used in first eregi() function in adminindex.php is slightly wrong:

    Code:
    if (eregi("^..?$", $file)) {
    This checks if the filename consists of one random character or two random character. I think the intention was to check for the directory links, and thus the regexp should be rewritten as:

    Code:
    if (eregi("^\\.\\.?$", $file)) {
    That's also used in the other eregi() calls.
    ----

    So all in all, it was a short introduction into the DOMXML functions. What I found strange is how the editing of a file works. Instead of reading the file into a XML object and manipulating it's nodes and re-saving, a new XML object is created from scratch and overwrites the old file. The author calls this "effective". But doesn't this approach contradict the search functionality, where each document gets read into a XML object and checked if a node's content matches the search parameters? IMHO that's not a consistent behaviour.

    It would've been nice if XSL templating would have been discussed, because from the article offers now I think no one's really convinced that it's a more effective system than relying on a database as the data storage tier.

    P.S: I was only able to get DomDocument->dump_file() and domxml_open_file() to work if the filename was preceded by the current working directory, which you get from getcwd(). Happened in PHP 4.3.1 with libxml 20430, Win2k with PHP running as module in Apache2.

  25. #25
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rfl
    i've windows XP pro, apache 2, php 4.3.1 and mysql 2;
    the domxml i've is called php_domxml.dll as the one you recomended.What do i do?
    rfl,

    Try uncommenting the "libxml" line in your PHP.ini file... I have a feeling that will do the trick.


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
  •