Zend Framework AjaxLink addHelperPath

时间:2012-07-28 03:54:27

标签: zend-framework

bootstrap.php中:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initView()
    {


        // Initialize view
        $view = new Zend_View();
        $view->doctype('XHTML1_STRICT');        
        $view->headTitle('Book Store');
        $view->headScript()->setFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
        $view->headScript()->appendFile('../../js/jquery.pagination.js');



        $view->headLink()->setStylesheet('../../css/style.css');
        $view->headLink()->appendStylesheet('../../css/pagination.css');
        $view->headLink()->appendStylesheet('../../css/formError.css');




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

    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
    $viewRenderer->setView($view);
    Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
           return $view;
    }

}

Index.phtml:

<?php echo $this->ajaxLink("Show me something",
                    "test",
                    array('update' => '#content'));?>


<div class="left_content">
    <div class="title"><span class="title_icon"></span>Featured books</div>
    <div class="title"><span class="title_icon"></span>New books</div> 

           <div class="new_products">
            <div id="content"> </div>
    <?php

    $result=$this->result; 
        foreach($result as $bookName){
            ?>

                         <div class="new_prod_box">
                        <a href="details.html"><b> <?php echo  $bookName['book'];  ?></b></a>
                        <div class="new_prod_bg">
                        <span class="new_icon"><img src="../../images/new_icon.gif" alt="" title="" /></span>
                        <a href="details.html"><img src="../..<?php echo $bookName['pic']; ?>" alt="" title="" class="thumb" border="0" /></a>
                        <input class="register"  type="button" value="AddtoCart">
                        </div>           
                    </div>


            <?php
        }


    ?>          
            </div> 


        <div class="clear"></div>
        </div><!--end of left content-->

这里我的ajaxlink()无法正常工作,重定向到“应用程序错误页面”。

1 个答案:

答案 0 :(得分:0)

路线“测试”是否真的有效?因为如果它不存在就能解释为什么你会得到一个应用程序错误页面