Ok, here is something strange that has had me stumped for about 45 minutes…
I have a custom .tpl.php file that I am using to theme a node view. I have plenty of PHP already functioning in this template, but today I had a couple of CCK fields I wanted to move around.
However, when I add my snippet in, I get “Parse error: syntax error, unexpected ‘[‘”
<?php print $node->field-account-status[0]['value']; ?>
The thing is, this is a fairly common snippet and should function. Examples of it are used here http://groups.drupal.org/node/25064
Here is the same snippet showing PHP above and below it, both working..Why is this snippet throwing this error???
<h2>Service Requests for <?php print $node->title; ?> </h2>
//lines above and below this one are working PHP
<?php print $node->field-account-status[0]['value']; ?>
<?php
$i = 0;
print '<table class="views-account-sr">';
The problem is that you are using
-in a variable name.-is not valid in any PHP identifier.-is the subtraction operator.You probably meant to use
_: