Domanda

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) ?

È stato utile?

Soluzione

Placeholder is the solution, it capture once, and the output can be used multiple times :

<?  $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'); ?>

Altri suggerimenti

Without knowing what your code looks like a common way to do this using Zend Framework views would be:

/paginatorViewscript.phtml

/* 
    Paginator script content 
*/

Your catalog page

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

That way the script is shown twice (at top and bottom). You explicitly say you don't want to do this without external viewscript but this is the way to do this.

Maybe you could show why you don't want to use external viewscript?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top