Hi,

Im a bit of a newie to Drupal so any help would be apperciated! thanks in advance..

I have written some code to get some data from an array eg:

============================================
$total_images = $content['field_gallery_img']['#object']->field_gallery_img;

global $base_url;
foreach ($total_images as $value)
{
$imageURL = $base_url.'/sites/default/files/'. $value['filename'];
print ('Only local images are allowed.');
// print($value['uri'] . '
');
}

===========================================

When viewing the page whilst logged in to drupal everthing is fine and the data is viewable.

When I logout and view the page the array is no longer available, throwing an error like this:

==========================
Undefined index: filename in include() (line 171 of C:\wamp\www\TwoSevenCreative\site\sites\all\themes\twosevencreative\templates\node--work.tpl.php)
==========================

Regards

Dave

Comments

steffenr’s picture

Have you checked the field permissions ? In this case these variables / fields are not accessible in the frontend / content..
You also could use the devel module to look for all fields available in content variable..
http://drupal.org/project/devel

davmartinuk’s picture

Thanks, I'll take a look into that and let you know.

Regards
Dave

davmartinuk’s picture

Thanks for the reply ;-)

I have looked at the $content array using: dprint_r($content);

And its all visable in the whilst logged in. Its when I log out nothing is retrevied! how, why etc. Sorry i know this is basic stuff but I have looked through drupal and can find nowhere to change field permission other than the usual 'edit, delete etc'. I have used the devel module, obviously the array shows as im logged in.

Regards