1283 Posts
Bucklash
8 years ago
Topic

Hi Again

I am customising a template as a way of learning.

I have been looking at and basing my customisations off of designbengel's seb_rotator.

For my search I have 4 results, however, I end up with the 4 results outputting for EACH result.

The key code in my index.php file is 

    $i = 0;
    
    foreach ( $items as $pk => $item ) {
        echo '<div class="item">';
        echo $cck->renderPosition( 'mainbody' ); // I have tried $item->...
        echo '</div>';
        $i++;
    }

In seb_rotator it is

    $i = 0;

    foreach ( $items as $pk => $item ) {
        echo $item->renderPosition( 'element' );
        i++;
    }

Any tips on how to output the results only once each?

Thanks 

Bucklash

Get a VIP membership
4229 Posts
Kadministrator
8 years ago
1
Level 1

Why don't you use designbengel's solution? 

echo $cck->renderPosition( 'mainbody' ); will output the whole mainbody, I would say you are using wrong template as base for your customization if $item does not work.

1283 Posts
Bucklash
8 years ago
0
Level 2

Hi Klas and thanks

I think I understand it now:

The List view is generated by a template eg seb_blog, ...

    

... In that templates output you can add the item view using an extra template eg seb_minima

   

That would explain why I was getting duplicated output, because the item view was outputing all of the results, and the list view was generating an item view for each result.

Bucklash

Get a VIP membership