留言板

Image Rotation in Web content Portlet

thumbnail
prakash harigopal,修改在13 年前。

Image Rotation in Web content Portlet

Regular Member 帖子: 101 加入日期: 10-6-23 最近的帖子
Hi,
I want to build a journal portlet with some images and it should be a notice board with some news and the images has to be rotated in a sequential fashion. In a nutshell the banner in , Liferay.com home page contains the news and some options to navigate forth back.

I tried to put some Javascript code in VM templates and finally came to know that VM and JS can not be linked as they are differed in client/server. Pls tell me does liferay supports any inbuilt portlets to achieve this or how can we handle JS things through VM Templates.

thanks
prakash.
thumbnail
Bavithra Rajendran,修改在13 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 123 加入日期: 09-10-8 最近的帖子
Hi !

Hope this link might be helpful.

Thanks,
Bavithra Rajendran
thumbnail
prakash harigopal,修改在13 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 101 加入日期: 10-6-23 最近的帖子
Thanks for the valuable article.
But can you tell me how can i link the Jquery.js into my template.
I have tried adding as below

<!-- include jQuery library -->
<script type="text/javascript" src="html/js/jquery/jquery.js"></script>

And its not getting the correct JS file , instead of that its trying to get the path as below

<virtualhost>/web/guest/html/js/jquery/jquery.js

which is not the correct way. Can you help me to resolve this.

thanks
Prakash.
sandeep tripathi,修改在12 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 100 加入日期: 11-10-19 最近的帖子
Hi Bavithra,
thanks a lot i had created the banner using the link u had provide it was a great help .
but i want to browse the images for banner from my image gallery and not from by desktop the so that i am sure that i can get the images for the banner every time.
so can u pls help me with that .

Regards
Sandeep
Daniel Wilmes,修改在12 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 164 加入日期: 11-5-23 最近的帖子
You could create a custom portlet that can upload images to the IGImage object and do an expando even on the object and store URLs. Or you could just use the built in liferay IGImage portlet. Here is how you would go about getting the data out of the database (of course I store all my data in the default community):

ThemeDisplay displayTheme = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
User defaultUser = UserLocalServiceUtil.getDefaultUser(CompanyThreadLocal.getCompanyId());
List listFolders = IGFolderLocalServiceUtil.getFolders(displayTheme.getScopeGroupId());
ServiceContext serviceContext = new ServiceContext();
serviceContext.setScopeGroupId(displayTheme.getScopeGroupId());
IGFolder folderVerify = null;
IGFolder folder = null;
List images = null;
boolean flag = false;
long folderID = 0;
long defaultID = defaultUser.getUserId();
if (listFolders.size() > 0) {
for (int i = 0; i < listFolders.size(); i++) {
folderVerify = (IGFolder) listFolders.get(i);
if (folderVerify.getName().equals("rotator_images")) {
flag = true;
folderID = folderVerify.getFolderId();
}
}
}
if (flag == false) {
folder =
IGFolderLocalServiceUtil.addFolder(defaultID, folderID, "rotator_images", "Images for the rotator", serviceContext);
folderID = folder.getFolderId();
}
try{
images = IGImageLocalServiceUtil.getImages(displayTheme.getLayout().getGroupId(), folderID);
}catch(Exception e){

}

You can then loop through the list for the images.
sandeep tripathi,修改在12 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 100 加入日期: 11-10-19 最近的帖子
HI Daniel ,

I am using liferay 6.0.5 bundle i had try to search liferay IGImage portlet but i do not find it are u talking about image gallery .
and the code that u gave where should i need to put that code should i create a new portlet for this activity .

thanks in advance .
Regards
Sandeep
Daniel Wilmes,修改在12 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 164 加入日期: 11-5-23 最近的帖子
I use the Image Gallery portlet at the community level to store images. This way the carousel can grab the data from the IGImage objects. Hope that helps.
thumbnail
jelmer kuperus,修改在13 年前。

RE: Image Rotation in Web content Portlet

Liferay Legend 帖子: 1191 加入日期: 10-3-10 最近的帖子
This might be of some help to you

http://videos.liferay.com/lifecasts/portal/6.0/105.mp4
thumbnail
prakash harigopal,修改在13 年前。

RE: Image Rotation in Web content Portlet

Regular Member 帖子: 101 加入日期: 10-6-23 最近的帖子
Jelmer,
Thanks for your reply.
I have resolved the issue by adding the jquery.js to my theme's portal_normal.vm page.
Now i am able to see the Banner navigation as showing on Liferay.com

Thanks all for your inputs.

~Prakash.
Joon Chew,修改在12 年前。

RE: Image Rotation in Web content Portlet

New Member 帖子: 2 加入日期: 11-8-23 最近的帖子
Hi Jelmer,

For the video you have suggested (http://videos.liferay.com/lifecasts/portal/6.0/105.mp4), it mentioned about the carousel template, may I know where can I find this template pls? Thanks.

Regards,
Joon
thumbnail
jelmer kuperus,修改在12 年前。

RE: Image Rotation in Web content Portlet

Liferay Legend 帖子: 1191 加入日期: 10-3-10 最近的帖子
I believe those are in the default-web-content-hook plugin

https://github.com/liferay/liferay-plugins/blob/master/hooks/default-web-content-hook/docroot/WEB-INF/src/resources/structures/multiple_item_carousel.xml
https://github.com/liferay/liferay-plugins/blob/master/hooks/default-web-content-hook/docroot/WEB-INF/src/resources/templates/multiple_item_carousel.vm
Joon Chew,修改在12 年前。

RE: Image Rotation in Web content Portlet

New Member 帖子: 2 加入日期: 11-8-23 最近的帖子
Thank you very much for your kind assistance.

Regards,
Joon