Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP/Drupal 7 error Parse error: syntax error, unexpected T_GLOBAL in (C\......)
    primarykey
    data
    text
    <p>I'm building a custom node which outputs 3 sets of images, all of which will change according to a parameter passed to the mooFoo() function. however I'm getting the "Parse error: syntax error, unexpected T_GLOBAL" error and its not very descriptive, could anyone maybe give me a nod as to where I could have went wrong, I've had a scan through google without finding anything mega helpful. my code is below...</p> <pre><code>&lt;?php $rooPath = 'http://localhost/'; //path from application root $relPath = 'trl/sites/default/files/'; $labTrl = 'TRL'; $dClass = 'ovinline'; //DEV $imgPathRed = 'redNodePng6160.png'; $imgPathAmb = 'amberNodePng6160.png'; $imgPathGre = 'greenNodePng6160.png'; function mooFoo($img){ $img2 = $img; switch($img2){ case 1: $fullPath = global $rooPath . global $relPath . global $imgPathRed; break; case 2: $fullPath = global $rooPath . global $relPath . global $imgPathAmber; break; case 3: $fullPath = global $rooPath . global $relPath . global $imgPathGreen; break; } return $fullPath; } ?&gt; &lt;div class="&lt;?php echo $dClass?&gt;"&gt; &lt;div class="field-label"&gt;&lt;?php echo $labTrl?&gt; 1:&amp;nbsp;&lt;/div&gt; &lt;div class="field-items"&gt; &lt;div class="field-item even"&gt; &lt;img typeof="foaf:Image" src="&lt;?php echo mooFoo(2)?&gt;" width="61" height="60" alt="" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Off top of my head I may not be able to print to screen from the way I've called mooFoo() in the html however I dont think thats where its borking so I'm assuming its to do with the way I'm trying to use the globals but I cant get right to the nuts and bolts of it...If anyone can help me out at all I'd greatly appreciate it.</p> <p>Many thanks</p> <p>Peter </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload