[dokuwiki] Problem with script tag generation in TPL_METAHEADER_OUTPUT event
- From: "Mikhail I. Izmestev" <izmmishao5@xxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sat, 04 Apr 2009 00:52:02 +0500
Hi.
I propose the following patch, which corrects work of
_tpl_metaheaders_action function used by TPL_METAHEADER_OUTPUT event,
because self closed script tags is not correct.
Simple example (from
http://www.dokuwiki.org/devel:event:tpl_metaheader_output):
1.
// Adding a JavaScript File
2.
$event->data["script"][] = array (
3.
"type" => "text/javascript",
4.
"src" => "lib/plugins/myplugin/javascript_library.js",
5.
);
it generates the following html code:
<script type="text/javascript" src="lib/plugins/myplugin/javascript_library.js"
/>
--- dokuwiki/inc/template.php~ 2009-04-03 15:45:06.000000000 +0500
+++ dokuwiki/inc/template.php 2009-04-03 16:10:44.000000000 +0500
@@ -372,7 +372,7 @@
foreach($data as $tag => $inst){
foreach($inst as $attr){
echo '<',$tag,' ',buildAttributes($attr);
- if(isset($attr['_data'])){
+ if(isset($attr['_data']) || $tag == 'script'){
if($tag == 'script' && $attr['_data'])
$attr['_data'] = "<!--//--><![CDATA[//><!--\n".
$attr['_data'].
Other related posts:
- » [dokuwiki] Problem with script tag generation in TPL_METAHEADER_OUTPUT event - Mikhail I. Izmestev