Simple Shortcut to PHP echo – Keep it Neat and Tidy

by Carey on November 4, 2010

Post image for Simple Shortcut to PHP echo – Keep it Neat and Tidy

Try this for a simple way to echo a variable in the midst of your html:

{code type=php}

{/code}

You can also use this to show the return value of a function:

{code type=php}

{/code}

This requires the php directive short_open_tag to be set to 1 (done via php.ini or .htaccess). Most hosts will have this set to 1 by default although there are some that will stop this altogether – keep this in mind if your code is to be widely used.

Leave a Comment

Previous post:

Next post: