Fork me on GitHub

problems with plugin placement  Bottom

  • hi,
    i created a few plugins for xanthia. one for example is about the mimetype, doctype etc for XHTML documents, that is sent depending on the browser's support. this finally enables REAL XHTML valid code with mimetype application/xhtml+xml.
    anyway, when i put this plugin into my themes folder, a few blank (white space) lines are generated on top of my source code. the problem is that the
  • Quote

    i created a few plugins for xanthia. one for example is about the mimetype, doctype etc for XHTML documents, that is sent depending on the browser's support. this finally enables REAL XHTML valid code with mimetype application/xhtml+xml.

    we've just discussed something like this on the devlist icon_smile

    i guess http://smarty.incutio.com/?page=DOCTYPEHeaderPlugin might be of interest for you (although the XHTML detection is definitly not really good and will be changed before we add a related plugin to the codebase). right now i'm fixing the remaining bugs when using application/xhtml+xml - see http://www.krapohl.info for a working demo (as long you are using a xml-capable browser of course)

    note: feel free to discuss this topic also at the german support site http://www.post-nuke.net icon_wink

    --
    regards from germany
    ..::[Zikula Application Framework]::.. ..::[SEO-Blog]::.. ..::[CMS Sicherheit]::..
  • thx for your reply!
    i solved the issue with these blank lines in the source code in activating an according option in the xanthia administration. i'm an idiot ;)
    but nevertheless, i still don't understand why they are generated as i tried to explain earlier... though, i Don't care anymore.

    the Smarty plugin looks very promising, thanks for that link!
    i can post the plugin i am using. the code is taken from http://www.workingwith.me.uk/articles/scripting/mimetypes/, modified to fit my needs and just wrapped into a plugin, basta:

    Code

    <?php

    function smarty_function_mimetype($params, &$smarty)
    {
        extract($params);
        unset($params);

    }
    $xmllang = pnConfigGetVar('backend_language');
    $charset = "iso-8859-1";
    $mime = "text/html";

    function fix_code($buffer) {
       return (str_replace(" />", ">", $buffer));
    }

    if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
       # if there's a Q value for "application/xhtml+xml" then also
       # retrieve the Q value for "text/html"
       if(preg_match("/application\/xhtml\+xml;q=0(\.[1-9]+)/i",
                     $_SERVER["HTTP_ACCEPT"], $matches)) {
          $xhtml_q = $matches[1];
          if(preg_match("/text\/html;q=0(\.[1-9]+)/i",
                        $_SERVER["HTTP_ACCEPT"], $matches)) {
             $html_q = $matches[1];
             # if the Q value for XHTML is greater than or equal to that
             # for HTML then use the "application/xhtml+xml" mimetype
             if($xhtml_q >= $html_q) {
                $mime = "application/xhtml+xml";
             }
          }
       # if there was no Q value, then just use the
       # "application/xhtml+xml" mimetype
       } else {
          $mime = "application/xhtml+xml";
       }
    }

    # special check for the W3C_Validator
    if (stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) {
       $mime = "application/xhtml+xml";
    }

    # set the prolog_type according to the mime type which was determined
    if($mime == "application/xhtml+xml") {
       $prolog_type = "<?xml version='1.0' encoding='$charset' ?>
       <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
          \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
       <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$xmllang\" xml:lang=\"$xmllang\">
          "
    ;
    } else {
       ob_start("fix_code");
       $prolog_type = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"
          \"http://www.w3.org/TR/html4/strict.dtd\">
       <html lang=\"$xmllang\">
          "
    ;
    }

    # finally, output the mime type and prolog type
    header("Content-Type: $mime;charset=$charset");
    header("Vary: Accept");
    print $prolog_type
       

    ?>


    as you can see i used the XHTML 1.0 strict doctype, to be able to use the lang attribute (which is deprecated in 1.1). replacing everything above and including the tag, with absolutely works for me =)

    BTW, i couldn't find a topic related to this on post-nuke.net. do you have a link or should i open a new discussion?

    regards
    philipp

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