2013-07-31 35 views
1

我對yii有點新。我使用下面的代碼來創建main template如何從Yii中刪除CDATA

<html xmlns="http://www.w3.org/1999/xhtml"> 
<title>Schedule an appointment with My business</title> 
<link href='https://fonts.googleapis.com/css?family=Signika' rel='stylesheet' type='text/css'> 
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/bookpage/style.css" type="text/css"> 
<link rel="stylesheet" media="all" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/modal-form-css/jquery-ui.css" /> 
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/bookpage/appointpress.css" type="text/css"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/datepickercss/jquery.ui.datepicker.css" type="text/css"> 
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/datepickercss/jquery.ui.theme.css" type="text/css"> 
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/datepickercss/jquery-ui.css" type="text/css"> 

<!--<script type="text/javascript" src="//sslstatic.wix.com/services/js-sdk/1.19.0/js/Wix.js"></script> --> 

<div class="header" style="height:60px;"> 
    <div id="inner_header" style="padding-top:5px;"> 
    <span style="float:right;color:rgb(68, 68, 68); margin-top:-10px;"><a href="http://appointpress.com">Appointpress</a> | Powerful Online Scheduling</span> 
    </div> 
</div> 
<body style="background-color:FFFFFF; font-family:Signika"> 
    <div class="container-fluid"> 
      <?php echo $content; ?> 
    </div> 
    <script src="<?php echo Yii::app()->request->baseUrl; ?>/css/appcal/jquery-1.9.1.js"></script> 
    <script src="<?php echo Yii::app()->request->baseUrl; ?>/css/appcal/jquery-ui-1.10.2.custom.js"></script> 
    <!--date validation--> 
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/date.js" /></script> 
</body> 
</html> 

但在控制檯中我得到的最後文件的一些CDATA加入當我看到它到控制檯。

<script type="text/javascript" src="/customers/js/date.js" /></script> 
<script type="text/javascript"> 
/*<![CDATA[*/ 
jQuery(function($) { 
jQuery('a[rel="tooltip"]').tooltip(); 
jQuery('a[rel="popover"]').popover(); 
}); 
/*]]>*/ 
</script> 
</body> 

這不是在Firefox or Google chrome問題。但在IE有問題。我無法弄清楚它從哪裏出來以及如何刪除它?

請大家幫忙解決這個問題嗎?

感謝

+2

的[CDATA可能重複的自動添加在Yii的JS?](http://stackoverflow.com/questions/16656317/cdata-being-added-automatically-on-js-in-yii) –

回答

1

這是自動被Yii創建,以防止誤解由舊的瀏覽器,XML的文件或不知道的JavaScript的瀏覽器。 這應該不會導致任何問題。 你能發表出現的錯誤訊息?

而且使用Yii的時候,你應該使用這些 「Yii開發的方法」 包含的JavaScript:

<?php 
    $baseUrl = Yii::app()->baseUrl; 
    Yii::app()->getClientScript()->registerScriptFile($baseUrl.'/js/someJs.js'); 
?> 

還要檢查Yii開發的Docu上JS:http://www.yiiframework.com/wiki/394/javascript-and-ajax-with-yii/#hh6

+0

我收到錯誤:'對象不支持此屬性或方法224,行443字符1'線443是:

+1

好吧,您正在使用IE瀏覽器遇到的一些JavaScript/Jquery問題。這與CDATA標籤無關。在這種情況下,你必須檢查你的jQuery代碼。 – user619