Jump to content

slice / filter problem


Alessio Dal Bianco
 Share

Recommended Posts

Hi all,

i found a problem regarding filtering items.

For example i limit the number of images (4) in this way:

<?php if( count($page->images) )  foreach( $page->images->filter("limit=4") as $seoImg ): ?>
        <meta property="og:image" content="<?php echo "http://".$config->httpHost.$seoImg->size(300,300)->url ?>" />
<?php endforeach; ?>

More later in the template i create the main gallery with ALL images (about 10 images):

<?php foreach( $page->images as $img ): ?>
                <li>
                    <div class="text" style="background-image:url(<?php echo $img->width(80)->url ?>)">
                        <?php echo $img->description; ?>
                    </div>
                </li>
<?php endforeach; ?>

But when i call "$page->images" it returns me only 4 items, same behavior with "slice(0,4)". I've tried also with "$page->get('images')" with the hope that in this way i can override the filter... But nothing, it seems that the results of filters override the original results in the property.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...