2013-07-31 33 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