SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CMS related question

    Hey guys,

    Please forgive me if this question has already been asked and answered. I searched the forums, but haven't found an answer to exactly what I'm wondering.

    This is what I want to do, I want to make a CMS that is easily installable for the average user (using php / mysql). Now, I want the content stored in a db as simple XML. Now, it would be nice if everybody had support for XSLT, but that isn't the case.

    So, I want to include some way of inserting the content into the template, and outputting that for the user.

    This is how I am thinking of having the content in the DB:

    <article>
    <title>Title goes here</title>
    <page>
    <section>
    <title>Section title</title>
    <body>blah blah blah blah</body>
    </section>
    </page>
    <page>
    <section>
    <title>Section title</title>
    <body>blah blah blah blah</body>
    </section>
    </page>
    </article>

    Ok, so with XSLT, converting this would be easy.

    But, what about with just php, how would I do it? Is there some reusable code out there? I was looking at smarty, but I'm not sure that is exactly what I want.

    please enlighten me

    thanks,
    -cARL
    Ohai!

  2. #2
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is definately reusable stuff out there. Basically you can get PHP to act as the XML > PHP translator, converting the stuff before the browser gets it.

    Best to start with some tutorial;

    XML with PHP 1

    XML with PHP 1

    XSL Transformation With PHP And Sablotron

  3. #3
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    Isn't the problem with using the actual XML functions provided with PHP that (at least for the *nix versions) you have to compile PHP with XML support? How many hosts really support that? I'm trying to figure a way to make a script that will be usable on the greatest number of servers...

    Do the xml_* functions work on all hosts?

    -cARL
    Ohai!

  4. #4
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well yes - but there are many ways to parse XML - you can even write your own classes doing bizarre things with preg and str_replace.

    Have a look at your php_info - if you see one of the compile options, you've got some kind of XML parser;

    --with-dom[=DIR]
    Include DOM support (requires libxml >= 2.4.2). DIR is the libxml install directory, defaults to /usr. - http://www.php.net/manual/en/ref.domxml.php

    --with-xml
    Using bundled expat lib - http://www.php.net/manual/en/ref.xml.php

    --with-expat-dir=DIR
    XML: external libexpat install dir.


    If you've got access to none of these, all is not lost (and you dont need to write your own classes) - just get ezXML

  5. #5
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    That's what I wanted to know

    -cARL
    Ohai!


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
  •