Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a ctools content type plugin and I am doing a lookup for some nodes which I then want to pass to my template file. I can do this fine, but I want to know the correct way to do it.

Should the image_style_url / theme function be in my content type plugin file or in the template file? if I do print render($image_styled); this doesn't work in the template file so what am I doing wrong here?

if($conf['content_priority']['template'] == '1') {
        //how do you want the stuff outputted?
        foreach($output['#items'] as $key => $item) {
          $content[$key]['title'] = $item['#node']->title;
          $image = reset(field_get_items('node', $item['#node'], 'vimn_image'));
          $content[$key]['image_path'] = file_create_url($image['uri']);
          $content[$key]['image_styled_path'] = image_style_url('promo_140',$image['uri']);
          $content[$key]['image_styled'] = theme('image_style', array(
            'style_name' => 'promo_140',
            'path' => $image['uri'],
            'getsize' => TRUE,
             'attributes' => array(
               //'class' => 'thumb',
               'width' => '140',
               'height' => '105'
            )
          ));
        }
        ;
        $block->content = theme('vimn_franchise_1', array(
          'items' => $content
        ));

In the template file:

<?php

//what needs outputting?
foreach($items as $item) {
   print $item['title'] . '</br>';
   print $item['image_styled'];
}

?>
share|improve this question
add comment (requires an account with 50 reputation)

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.