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
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
problems with plugin placement
-
- Rank: Software Foundation
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 3814
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
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
--
regards from germany
..::[Zikula Application Framework]::.. ..::[SEO-Blog]::.. ..::[CMS Sicherheit]::.. -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 21
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
- Moderated by:
- Support
