osclass

image fetching is not working in OSClass when i gives twice


I'm using OSClass. I'm new for this.

In ...\oc-content\themes\modern\item.php, i'm using following codes,

<div class="image slider">
    <?php if( osc_images_enabled_at_items() ) { ?>
        <?php if( osc_count_item_resources() > 0 ) { ?>
            <?php for ( $i = 0; osc_has_item_resources(); $i++ ) { ?>
                <img src="<?php echo osc_resource_url(); ?>" width="100%" height="240px;" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />

            <?php } ?>
        <?php } ?>
    <?php } ?>  
</div>


<div class="layout slider">
    <?php if( osc_images_enabled_at_items() ) { ?>
        <?php if( osc_count_item_resources() > 0 ) { ?>
            <?php for ( $i = 0; osc_has_item_resources(); $i++ ) { ?>
                <img src="<?php echo osc_resource_url(); ?>" width="100%" height="240px;" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />

            <?php } ?>
        <?php } ?>
    <?php } ?>  
</div>

Here, image slider gives images. But, layout slider gives empty div. I'm using same code for both div.

Where is Problem?


Solution

  • Add this <?php osc_reset_resources(); ?> after <div class="layout slider"> and before the second for, the iterator of the resources has to be reset.