-1

I'm getting this error: Notice: Undefined index: und in function include() (line 5 in file node--view--latest-projects.tpl.php).

the code is:

<li class="<?php print strip_tags(render($content['field_portfolio_category'])); ?>">
<div class="span3">
    <div class="portfolio-item thumbnail">
        <a class="thumb-info lightbox" href="#popupProject_<?php print $node->nid; ?>" data-plugin-options='{"type":"inline", preloader: false}'>
            <img src="<?php echo file_create_url($node->field_image['und'][0]['uri']); ?>" alt="item">
            <span class="thumb-info-title">
              <span class="thumb-info-inner"><?php print $title; ?></span>
                <span class="thumb-info-type"><?php print strip_tags(render($content['field_portfolio_category'])); ?></span>
            </span>
            <span class="thumb-info-action">
                <span title="Universal" href="#" class="thumb-info-action-icon"><i class="icon-link"></i></span>
            </span>
        </a>
    </div>
</div>

in

Please help, as I haven't been able to define the variable...

Kristiono Setyadi
  • 5,635
  • 1
  • 19
  • 29

1 Answers1

0

One of these three arrays/array keys is not available ['und'][0]['uri'] in $node->field_image['und'][0]['uri']. To get rid of it you should do a condition:

<?php if(isset($node->field_image['und'][0]['uri'])) { ?>
    <img src="<?php echo file_create_url($node->field_image['und'][0]['uri']); ?>" alt="item">
<?php } ?>

OR figure out if one of the arrays/array keys is written wrong.

EDIT: I just noticed that you mentioned und in your error...so it wasn't one of the three, it was the und array...

Rasclatt
  • 12,498
  • 3
  • 25
  • 33