jRating明星没有在Zend Framework中展示

时间:2012-05-01 11:58:20

标签: jquery zend-framework

我正在使用jRating - jQuery Plugin v2.2(最新版本),我可以在html中使用它但是当我将所有内容添加到我的ZF项目时它不起作用。星形图像没有显示..路径是100%我有三重检查。我也有jQuery灯箱插件的图像问题,上一页,下一页和关闭图像按钮不起作用,ZF jQuery和图像有什么我想念的吗?

这是ZF版本:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >            <title>Clubs - Manchester Nightlife</title>
<link href="/MN/public/css/jRating.jquery.css" media="screen" rel="stylesheet"     type="text/css" >
<script type="text/javascript" src="/MN/public/js/jquery.js"></script>
<script type="text/javascript" src="/MN/public/js/jRating.jquery.js"></script>
    </head>
    <body>
<div class="exemple">
    <div class="basic" id="12_1"></div>
</div>
    <script type="text/javascript">
    $(document).ready(function(){
        $('.basic').jRating();
    });
</script>
</div>
    <div class="clear"></div>
    </div>
</body>

这是ZF版本

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pluggin jRating : Ajax rating system with jQuery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="jquery/jRating.jquery.css" type="text/css" />
</head>
<body>
<div class="exemple">
<div class="basic" id="4_1"></div>
</div>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jRating.jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('.basic').jRating();
    });
</script>

脚本标签位于不同的位置,因为我使用ZF方式将它们添加到head标签中:

$this->headScript()->prependFile($this->baseUrl('/js/jquery.js'));

由于

1 个答案:

答案 0 :(得分:0)

每当我使用ZendX的JQuery库时,我总是要将以下代码添加到我的布局标题中

<?php echo $this->headLink();
      echo $this->headScript();
      $this->jQuery()->setUiVersion( '1.8.7' )->setVersion( '1.4.4' );
      echo $this->jQuery(); ?>

我不知道为什么会这样,但确实如此。

确保将视图助手添加到application.ini

resources.view.helperPath.ZendX_JQuery_View_Helper = APPLICATION_PATH "/../library/ZendX/JQuery/View/Helper"

然后在bootstrap.php中

protected function _initViewHelpers()
{
    $view = new Zend_View();
    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();

    $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
    $view->addHelperPath('ZendX/JQuery/View/Helper/JQuery', 'ZendX_JQuery_View_Helper_JQuery');

    $viewRenderer->setView($view);
    Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);

}