留言板

Need to add Photo Gallery

Dayanand Tiwari,修改在6 年前。

Need to add Photo Gallery

Junior Member 帖子: 91 加入日期: 17-5-25 最近的帖子
Hi,
I want add a photo gallery. Created a structure which has document and media and it has nested field as document and media. Now I need freemarker template code to achieve the same.
thumbnail
Massimo Bevilacqua,修改在6 年前。

RE: Need to add Photo Gallery

Regular Member 帖子: 210 加入日期: 16-12-27 最近的帖子
Hi,

which version of liferay do you use?
could you please post your structure code?
Dayanand Tiwari,修改在6 年前。

RE: Need to add Photo Gallery

Junior Member 帖子: 91 加入日期: 17-5-25 最近的帖子
Liferay 7 CE. Structure is simple text with image making text as repeatable where image is child and template has just iterating images. And I'm beginner for WCM.
thumbnail
Massimo Bevilacqua,修改在6 年前。

RE: Need to add Photo Gallery

Regular Member 帖子: 210 加入日期: 16-12-27 最近的帖子
I hope I have understand...
This is my structure:



this is my template:

<#if title.getSiblings()?has_content>
<div class="container">
    <div class="row">
    	&lt;#list title.getSiblings() as cur_title&gt;
    	<div class="col-sm-4">
    		${cur_title.getData()}
    		<img src="${cur_title.image.getData()}">
    	</div>
    	<!--#list-->
    </div>
</div>
<!--#if-->


this is my Web Content:



And that is the result (adjust div and css as you wish)

Dayanand Tiwari,修改在6 年前。

RE: Need to add Photo Gallery

Junior Member 帖子: 91 加入日期: 17-5-25 最近的帖子
Yes, you are correct. But I want images as below:
http://www.mrmwr.gov.om/new/en/PhotoGallery.aspx?li=6&Slide=true

if you click on one image, a popup comes up and it has a slider so that next and previous images can be shown. Same thing I want to add.
thumbnail
Massimo Bevilacqua,修改在6 年前。

RE: Need to add Photo Gallery

Regular Member 帖子: 210 加入日期: 16-12-27 最近的帖子
Once you have retrived the images you have to create your own Template or ADT to display it as you want

try to use this...

image-viewer

example of template using image viewer:

&lt;#if title.getSiblings()?has_content&gt;
<div id="myGallery">
&lt;#list title.getSiblings() as cur_title&gt;
    <a href="${cur_title.image.getData()}" title="${cur_title.getData()}">
    <img class="picture" src="${cur_title.image.getData()}">
  </a>
<!--#list-->
</div>
<!--#if-->

<script>
YUI().use(
  'aui-image-viewer',
  function(Y) {
    new Y.ImageViewer(
      {
        links: '#myGallery a',
        zIndex: 1,
        playing: false
      }
    ).render();
  }
);
</script>
Dayanand Tiwari,修改在6 年前。

RE: Need to add Photo Gallery

Junior Member 帖子: 91 加入日期: 17-5-25 最近的帖子
yes but can we do it like:
http://www.mrmwr.gov.om/new/en/PhotoGallery.aspx?li=6&Slide=true

here if you click one image popup comes up with slider.
thumbnail
Massimo Bevilacqua,修改在6 年前。

RE: Need to add Photo Gallery

Regular Member 帖子: 210 加入日期: 16-12-27 最近的帖子
Also in my example if you click one image a pop up comes up with slider
Dayanand Tiwari,修改在6 年前。

RE: Need to add Photo Gallery

Junior Member 帖子: 91 加入日期: 17-5-25 最近的帖子
But Background content is also coming in the popup. Do you have any idea to remove them:

Look at the attachment: