Can you add "Placeholder" pluin like Zend Framework in View?

In layout view template:


In action view template:

<?php $this->placeholder("footerjs")->captureStart();?>

......some complex js script or css tag.

<?php $this->placeholder("footerjs")->captureEnd();?>

can Phalcon add this new feature?


Maybe you can check out Phalcon Assets to do that job



I had read the Phalcon Assets,But it's can't solve the problem, or can you give me some examples? thank you.


thank you,

I known, I means can you add the placeholder feature at next release?

pwtitle, I think I was able to recreate the missing functionality by using output buffering and assigning the results to a view variable as follows:

In the action's view:

<!-- // -------------------------------------------------------------------------------- // --> <?php ob_start(); ?> <script type="text/javascript"> $(document).ready(function () { ... }); </script> <?php $this->view->setVar('jscript', ob_get_clean()); ?> <!-- // -------------------------------------------------------------------------------- // -->

Then, inside the modules "template" view, use that variables as follows:

<!-- Custom Page JavaScript --> <?php if (isset($jscript) && $jscript): ?> <?= $jscript; ?> <?php endif; ?>

This will scoop up the custom JS, exclude it from the action's view, assign it to a view variable, and that variable can be used in the main template to render it in the correct position.

-- Dante