Jump to content

Custom Block: Latest Image Feed

Featured Replies

Posted

Would it be possible to use Gallery's "New Images" block from the gallery home page elsewhere? Our users prefer the layout of the images there, where all are visible, rather than the scrolling "New Images Feed" widget. From what I could gather of the gallery index coding, this seems to be it:

{{if !empty( $new )}}
<div class='ipsBox'>
    <h2 class='ipsType_sectionTitle ipsType_reset'>{lang="new_images"}</h2>
    <div data-ipsPhotoLayout data-ipsPhotoLayout-itemTemplate='gallery.patchwork.indexItem' data-ipsPhotoLayout-maxRows='3' class='ipsPad ipsClearfix cGalleryPatchwork_index'>
        <ul class='ipsList_inline'>
            {{foreach $new as $image}}
                <li data-role='patchworkImage' data-json='{$image->json()|raw}'>
                    <a href='{$image->url()}'><img src='{file="$image->small_file_name" extension="gallery_Images"}' alt='' class='ipsJS_hide'></a>
                </li>
            {{endforeach}}
        </ul>
    </div>
</div>
{{endif}}

But it remains blank. Any help appreciated!

  • 2 weeks later...
  • Author

Anybody? Essentially we want this block on the main page as well as in the gallery:

image.thumb.png.c64e5415c199d56856752c0a21a5eea8.png

  • 1 month later...

I'm interested too, have you got it working since ? 

  • Author

No, not yet.

On 4/9/2018 at 7:10 AM, AlexWright said:

But it remains blank. Any help appreciated!

Change $new to $images

46 minutes ago, newbie LAC said:

Change $new to $images

First thing I did but it's not working, images are loading but not showing, it must be missing some script calls  ...

Thanks

Add

{expression="\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery'))"}
7 minutes ago, newbie LAC said:

Add


{expression="\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery'))"}

That's it, many thanks !

  • Author
10 hours ago, cb37fr said:

That's it, many thanks !

Can you paste the code you're using? I can't seem to get this to work.

25 minutes ago, AlexWright said:

Can you paste the code you're using? I can't seem to get this to work.

Well it's the exact same code you have posted, just replace "$new" by "$images"

{{if !empty( $new )}}

change to

{{if !empty( $images )}}

and same for the line

{{foreach $new as $image}}

change to

{{foreach $images as $image}}

and you paste the line to call the corresponding JS that Newbie Lac posted :

{expression="\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery'))"}

Of course you have to create a plugins block "image feed from gallery" and paste your code as "use as base for a custom template" in the "content" tab of the block settings. After that you can use your block where you want.

  • Author
10 minutes ago, cb37fr said:

 


{expression="\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery'))"}

 

Might be this line that isn't working properly. Can this be pasted anywhere in the block?

Edit: Nevermind, I've got it somewhat working. Though navigating away from the home-page and then back to where the block is displayed generates an empty block. This may have to do with caching though.

Edited by AlexWright

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.