We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6038
    • 228 Posts
    If possible, I always like to create my html with HTML 4.01 STRICT doctypes.

    Why? Mainly because it avoids the issues around ’certain browsers’ not being able to correctly interpret XHTML when sent as type application/xhtml+xml. I can’t see any real advantage to using XHTML over HTML anyways - its only relevant if you intend your web pages to be parsed by some other xml reading app.. anyway, I digress, and I’m not here to start any arguments.

    I’d like to collate here any tips that people have for making MODx Evolution, plus any snippets/plug-ins you use, output completely valid HTML. Currently I’m using MODx Evo 1.0.2 on sites I’m building.

    TinyMCE plugin
    If editors use TinyMCE, and insert line break tags, they come out as [tt]
    [/tt] because TinyMCE assumes you want XHTML. To change this into non-self-closing tags, simply modify your config script as seen here: http://modxcms.com/forums/index.php?topic=30013.0 and TinyMCE will output HTML.

    eForm snippet
    eForm also assumes you want self-closing tag format, so inserts [tt]
    [/tt] and [tt]<input />[/tt] tags ahoy. The simplest way to do this is to modify the eForm core snippet file at /assets/snippets/eform/eform.inc.php and go through and modify all the tag outputs.

    You could, I suppose, write a plug-in to do all of these sorts of things for you, checking the document for self-closing tags and replacing them with their implicit version, before output. Maybe someone has already done so?

    Anyway, I’d be keen to hear if anyone else has any tips or ideas to share on this!





      • 1343 ☆ A M B ☆
      • 2,213 Posts
      You shouldn’t need to modify the eForm snippet to generate HTML, you just need to define your own templates with HTML code. This is the better method as upgrades to MODx don’t overwrite your changes where as the above would be overwritten.

      On a side note I haven’t had any issues with sites non functioning/rendering properly when using XHTML, granted I think they are being servered as HTML instead of xhtml+xml.

        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 6038
        • 228 Posts
        Quote from: AMDbuilder at Feb 07, 2010, 01:46 PM

        You shouldn’t need to modify the eForm snippet to generate HTML, you just need to define your own templates with HTML code.

        Yes, you can define your own templates, but don’t forget eForm then performs a conversion on your form input elements - parsing and removing the ’eform’ pseudo-attribute - and replaces your templates input element with a self-closed version. Which, unless you have built the plug-in i envisaged, is the only way I can see to get round this is by modifing the core snippet file.