PHP messes up <script> in the .tpl header
<p>I am writing some php code that creates pages from tpl files, which works just fine. However, I have decided to include some funky jquery stuff using the jqueryui engine and I can't get it to work. In the header.tpl, I have the following</p>

<pre><code>&lt;script src="...."&gt;&lt;/script&gt;
&lt;script&gt;
$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$("#dialog-message").dialog({ autoOpen: false })
$( "#dialog-message" ).dialog({
        modal: true,
        buttons: {
            Ok: function() {
        $( this ).dialog( "close" );
        }
    }
});     
$("#tac").click(function() {
    $( "#dialog-message" ).dialog('open');
    // prevent the default action, e.g., following a link
    return false;
}); 
});
&lt;/script&gt;
</code></pre>

<p>This code produces the desired effect when I test it in a plain html page. However, when the page is produced by the php code, it just doesn't. Besides, when I view source on this php-generated page, this is what I get in the header</p>

<pre><code>&lt;script&gt;
$(function() )

    $( "#dialog-message" ).dialog(
        }
    });

    $("#tac").click(function() );

});
&lt;/script&gt;
</code></pre>

<p>PHP seems to destroy most of the code and I can't understand why it happens. Any help would be greatly appreciated!</p>
