Jump to content

Custom Block: Latest Image Feed


AlexWright

Recommended Posts

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!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
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 !

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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