NuSphere PhpEd, Smarty {literal} blocks and syntax highlighting
Posted January 4th, 2010 in PHP
I recently upgraded to NuSphere PhpEd 5.9 and noticed that some {literal} blocks in a Smarty template did not have any syntax highlighting. I am not sure if this was the case previously for the same section of code but worked out the location of the {literal} tags needed to be moved for syntax highlighting to work.
Incorrect usage
This first example shows how the original section of code was formatted. In PhpEd 5.9 the code in the <script> section would be greyed out like a comment and not contain any syntax highlighting:
{literal}
<script type="text/javascript">
function somefunction() {
var foo = 'bar';
// there's no sytax highlighting here
// and everything is greyed out
}
</script>
{/literal}
Correct usage
The second correct example shows how the {literal} block should be inside the <script> tags. Once this is done the Javascript syntax highlighting will work as expected.
<script type="text/javascript">
{literal}
function somefunction() {
var foo = 'bar';
// that's better, now there's syntax highlighting
}
{/literal}
</script>
Related posts:
- Get all variables assigned to Smarty - Part 2 (Monday, November 23rd 2009)
- Type hinting with PHP (Thursday, October 1st 2009)
- Get all variables assigned to Smarty - Part 1 (Thursday, September 24th 2009)
- NuSphere PhpED 10% discount coupon code (Friday, September 18th 2009)
- PHP PEAR DB Code Completion in Zend Studio (Friday, November 2nd 2007)
Share or Bookmark
Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.
Subscribe or Follow
Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.
