StevenStark.com
Technical Blog for Joomla, LAMP and Flash Development. ALSO includes Application, interactives and game development.

...... Navigation

  • Home
  • Flash
  • Open Source
  • The Team
  • Background
  • Services
  • Portfolio
  • Projects
  • Contact

  • ...... Technical Blog

  • CMS (13)
  • Experiments (1)
  • Flash (9)
  • LAMP (1)
  • Misc (8)
  • Tutorials (5)


  • ...... Archives

  • April 2009
  • October 2008
  • March 2008
  • February 2008
  • January 2008
  • November 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • December 2006
  • August 2006
  •  

     

     

     

     

     

     

     

     

     

    < Papervision 3D 2.0 - ‘great white’ intro FlashBrite3D - free 3d text writer >

    Proposed new framework for CMS systems.

    I work with a lot of Content Management Systems, and one large problem is that 90% of the websites built with them look like each other. I believe this has to do with the difficulties in editing a module, component, plugin or extension’s output HTML code. This could be resolved with the use of XSLT, and we would also gain some nice side effects from doing so.

    What is XSLT? Well, in short, you take an XML document and template it out with a XSL file. Then we run these two files through PHP5 and the viewer sees only HTML code. Here’s an example:

    XML File:

    <xml>

    <para>Hi There</para>

    </xml>

    XSL File:

    <xsl:template match="para">
    <div class="hi"><p>

    <xsl:apply-templaes/>

    </p></div>
    </xsl:template>

    PHP5 File:
    $doc = new DOMDocument();

    $doc->load('cached_filename.xml');$xsl = new DomDocument();

    $xsl->load("filename.xsl");

    $proc = new XsltProcessor();

    $proc->registerPhpFunctions();

    $xsl = $proc->importStylesheet($xsl);

    print $proc->transformToXML($doc);

    Output html code:

    <div class="hi"><p>Hi There</p></div>

    So, how would this look? Let’s use Joomla! as an example. Every single module and component will come with a .php file and a .xsl file. The .php file will create a new cache of the .xml file required, if the xml does not exist or is unchanged. In some cases, the cache will need to be disabled. The cache filenames are saved to the database. The .XSL file will be saved to a special folder, allowing the developer to edit both the output XML and the XSL file used to template out the information.

    In most cases, developers will only need to modify the XSL file, meaning that there is no need to modify any PHP code. This also means that we will have much more control over the output code, even when using 3rd party extensions or messy code, and completely divides the output from the actual code.

    The problem would be moving everyone over to using the XSL / Xpath / Xpointer method of templating XML files into HTML. I don’t think learning is that big of an issue, however, because after you understand this stuff you will realize that it is easier to template out XML than it is to code raw HTML. For one, you know everything has a template, all your div’s get closed! Your design is just easier to maintain XHTML standards and not break.

    Also, with all these cached XML files we can easily string them together to create our RSS feed, and I am cure it would be easy to let the developer choose which files are included.

    Do I have any support with this idea? Please comment.


    This entry was posted on Friday, January 4th, 2008 at 12:45 am and is filed under CMS.
    You can follow any responses to this entry through the RSS 2.0 feed.

    © 2000 - 2008, Steven Stark of StevenStark.com
    This site is built using: | Wordpress | Flex | Wrapper | JSON | APACHE | MySQL | PHP |
    Tech Note: Content is being parsed from XHTML and rendered inside Fash.