Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
AlexWright Posted April 9, 2018 Posted April 9, 2018 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!
AlexWright Posted April 18, 2018 Author Posted April 18, 2018 Anybody? Essentially we want this block on the main page as well as in the gallery:
newbie LAC Posted May 28, 2018 Posted May 28, 2018 On 4/9/2018 at 7:10 AM, AlexWright said: But it remains blank. Any help appreciated! Change $new to $images
cb37fr Posted May 28, 2018 Posted May 28, 2018 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
newbie LAC Posted May 28, 2018 Posted May 28, 2018 Add {expression="\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery'))"}
cb37fr Posted May 28, 2018 Posted May 28, 2018 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 !
AlexWright Posted May 28, 2018 Author Posted May 28, 2018 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.
cb37fr Posted May 28, 2018 Posted May 28, 2018 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.
AlexWright Posted May 28, 2018 Author Posted May 28, 2018 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.