0

I'm working on a page which show a list of articles of a catalog, with a pagination (I don't use Zend_Paginator)

The pagination bloc is ok, but I would render it multiple times (at the top and at the bottom of the list)

Inside the view script, is there a way to capture the output, and render it twice without using any external view script (which will be executed two times) ?

4

2 回答 2

1

占位符是解决方案,它捕获一次,输出可以多次使用:

<?  $this->placeholder('foo')->captureStart(); ?>
My script to make pagination...
<? $this->placeholder('foo')->captureEnd() ?>

<!-- used one time -->
<?= $this->placeholder('foo'); ?>
Items to display
<!-- used a second time -->
<?= $this->placeholder('foo'); ?>
于 2013-08-07T21:51:13.053 回答
0

在不知道您的代码看起来像什么的情况下,使用 Zend Framework 视图执行此操作的常用方法是:

/paginatorViewscript.phtml

/* 
    Paginator script content 
*/

您的目录页面

<?=$this->render('paginatorViewscript.phtml')?>
/* 
    various catalog content 
*/
<?=$this->render('paginatorViewscript.phtml')?>

这样脚本会显示两次(在顶部和底部)。您明确表示您不想在没有外部视图脚本的情况下执行此操作,但这是执行此操作的方法。

也许您可以说明为什么您不想使用外部视图脚本?

于 2013-08-07T14:05:42.153 回答