Fork me on GitHub

xhtml Compliance and pnModUrl  Bottom

  • One of the things that keeps popping up on the validator as I check my code is urls generated by the pnModUrl use the & symbol instead of the &.

    http://www.w3.org/TR/xhtml1/#guidelines


    Quote


    C.12. Using Ampersands in Attribute Values (and Elsewhere)
    In both SGML and XML, the ampersand character ("&") declares the beginning of an entity reference (e.g., ® for the registered trademark symbol "®"). Unfortunately, many HTML user agents have silently ignored incorrect usage of the ampersand character in HTML documents - treating ampersands that do not look like entity references as literal ampersands. XML-based user agents will not tolerate this incorrect usage, and any document that uses an ampersand incorrectly will not be "valid", and consequently will not conform to this specification. In order to ensure that documents are compatible with historical HTML user agents and XML-based user agents, ampersands used in a document that are to be treated as literal characters must be expressed themselves as an entity reference (e.g. "&"). For example, when the href attribute of the a element refers to a CGI script that takes parameters, it must be expressed as http://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user rather than as http://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user.


    I am just curious if there was going to be a change in the pnmodurl code to send the & instead of & anytime soon or if I should just ignore this validator error.
  • Don't ignore it... but changing pnModURL is not the fix..... The proper fix is to pass the result of pnModURL via pnVarPrepForDisplay e.g. pnVarPrepForDisplay(pnModURL(.....));. The associated pnRender plugin does this automatically.

    The reason for not 'fixing' pnModURL is that not all URLs are used as output. e.g. pnRedirect(pnModURL(....)).

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Great thanks combining the different plugins is something I hadn't really put to use I guess I really should be using pnvarprepfordisplay on all my output to ensure that I am outputting properly formated information.
  • If your working with pnRender then the pnmodurl plugin will already sort out the & and & issue since it passes the URL via pnVarPrepForDisplay.

    -Mark

    --
    Visit My homepage and Zikula themes.

This list is based on users active over the last 60 minutes.