Jump to content

Custom Block: Latest Image Feed


AlexWright

Recommended Posts

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...
  • 1 month later...
Posted
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

Posted
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 !

Posted
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.

Posted
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.

Archived

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

  • Recently Browsing   0 members

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