Zend Framework hidden gems

Last modified date

Comment: 1

Sometimes you come across hidden little gems in the Zend Framework that save you time, even if that’s just down to the amount of text you need to type. The Zend_View holds one of these little gems…

Did you know that you can use the short php open tags and echo tag in your view scripts, and you don’t even need to have this turned on in the php.ini file?

So you can have things like:

<? $this->viewHelper(); ?>

and:

<?= $this->variable; ?>

instead of:

<?php $this->viewHelper(); ?>
<?php echo $this->variable; ?>

Might not seem a lot, but when you have a lot of view scripts to write then you can save quite a few key strokes.

It’s able to do this, even if you have short_tags off (as it should be!) because Zend_View uses a stream to open and seek through the view script – Zend_View_Stream.

Share

1 Response

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.