引导带.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;
}
}
索引.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() 不起作用,它重定向到“应用程序错误页面”。