Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Kristian Gil
Carousel portlet
12 maggio 2011 8.33
Risposta

Kristian Gil

Punteggio: New Member

Messaggi: 22

Data di Iscrizione: 14 luglio 2010

Messaggi recenti

Hi,

We're planning on implementing a Carousel portlet like the one at Yahoo's home page.
Does anyone have a suggestion if there is already an existing portlet for this or if it's better to develop one from scratch?
One idea we had was to create another view for the Asset Publisher portlet using JQuery or maybe AlloyUI.
We're running on Liferay 5.1.7.

Any suggestion is appreciated, thanks!
Sergio Sanchez
RE: Carousel portlet
12 maggio 2011 10.07
Risposta

Sergio Sanchez

Punteggio: Junior Member

Messaggi: 41

Data di Iscrizione: 3 febbraio 2011

Messaggi recenti

I did that using the Jquery jcarousel plugin. This plugin needs the elements to move to be list items inside an unordered list, so I had to wrap the HTML that the asset publisher produced in li tags inside journal/asset/abstract.jsp and print ul tags inside asset_publisher/display/abstracts.jsp. Those JSPs need to be deployed inside a hook plugin.

Hope this helps
gofri _
RE: Carousel portlet
13 maggio 2011 6.48
Risposta

gofri _

Punteggio: Junior Member

Messaggi: 92

Data di Iscrizione: 2 marzo 2007

Messaggi recenti

The simplest way:

 1<script type="text/javascript" charset="utf-8">
 2AUI().ready('aui-carousel', function(A) {
 3
 4    var component = new A.Carousel(
 5        {
 6            intervalTime: 5,
 7            contentBox: '#divanim',
 8            activeIndex: 'rand',
 9            height: 28,
10            width: 780
11        }
12    )
13    .render();
14
15});
16</script>
Jelmer Kuperus
RE: Carousel portlet
13 maggio 2011 9.15
Risposta

Jelmer Kuperus

Punteggio: Liferay Legend

Messaggi: 1192

Data di Iscrizione: 10 marzo 2010

Messaggi recenti

You can use webcontent :

structure :

 1<root>
 2  <dynamic-element name='duration' type='list' index-type='' repeatable='false'>
 3  <meta-data>
 4            <entry name="displayAsTooltip"><![CDATA[false]]></entry>
 5            <entry name="required"><![CDATA[false]]></entry>
 6            <entry name="instructions"><![CDATA[Select how long, in seconds, you would prefer to display an item before switching to the next slide]]></entry>
 7            <entry name="label"><![CDATA[Item Duration]]></entry>
 8            <entry name="predefinedValue"><![CDATA[]]></entry>
 9        </meta-data>
10
11    <dynamic-element name='1' type='1' index-type='' repeatable='false'>  </dynamic-element>
12    <dynamic-element name='2' type='2' index-type='' repeatable='false'>  </dynamic-element>
13    <dynamic-element name='3' type='3' index-type='' repeatable='false'>  </dynamic-element>
14    <dynamic-element name='4' type='4' index-type='' repeatable='false'>  </dynamic-element>
15    <dynamic-element name='5' type='5' index-type='' repeatable='false'>  </dynamic-element>
16    <dynamic-element name='6' type='6' index-type='' repeatable='false'>  </dynamic-element>
17    <dynamic-element name='7' type='7' index-type='' repeatable='false'>  </dynamic-element>
18    <dynamic-element name='8' type='8' index-type='' repeatable='false'>  </dynamic-element>
19    <dynamic-element name='9' type='9' index-type='' repeatable='false'>  </dynamic-element>
20    <dynamic-element name='10' type='10' index-type='' repeatable='false'></dynamic-element>
21  </dynamic-element>
22  <dynamic-element name='height' type='text' index-type='' repeatable='false'>
23  <meta-data>
24            <entry name="displayAsTooltip"><![CDATA[false]]></entry>
25            <entry name="required"><![CDATA[true]]></entry>
26            <entry name="instructions"><![CDATA[This defines the height of the carousel, in pixels(px). Do not add "px" at the end of the value]]></entry>
27            <entry name="label"><![CDATA[Height]]></entry>
28            <entry name="predefinedValue"><![CDATA[]]></entry>
29        </meta-data>
30</dynamic-element>
31  <dynamic-element name='width' type='text' index-type='' repeatable='false'>
32  <meta-data>
33            <entry name="displayAsTooltip"><![CDATA[false]]></entry>
34            <entry name="required"><![CDATA[true]]></entry>
35            <entry name="instructions"><![CDATA[This defines the width of the carousel, in pixels(px). Do not add "px" at the end of the value]]></entry>
36            <entry name="label"><![CDATA[Width]]></entry>
37            <entry name="predefinedValue"><![CDATA[]]></entry>
38        </meta-data>
39</dynamic-element>
40  <dynamic-element name='content' type='text_area' index-type='text' repeatable='true'>
41  <meta-data>
42            <entry name="displayAsTooltip"><![CDATA[false]]></entry>
43            <entry name="required"><![CDATA[true]]></entry>
44            <entry name="instructions"><![CDATA[This is the content of this slide. To create more slides, click on the " " button]]></entry>
45            <entry name="label"><![CDATA[content]]></entry>
46            <entry name="predefinedValue"><![CDATA[]]></entry>
47        </meta-data>
48</dynamic-element>
49</root>


Template


 1#set ($contentId = $reserved-article-id.getData())
 2#set ($contentClass = "multiple-items-" + $contentId + "-carousel")
 3
 4<style type="text/css" media="screen">
 5    #$contentClass {
 6        height: $height.getData()px;
 7        position: relative;
 8        width: $width.getData()px;
 9    }
10
11    #$contentClass .carousel-item {
12        height: $height.getData()px;
13        overflow: hidden;
14        width: $width.getData()px;
15        position: absolute;
16        top: 0;
17    }
18</style>
19
20<div id="$contentClass">
21    #foreach ($item in $content.getSiblings())
22        <div class="carousel-item">
23            $item.getData()
24        </div>
25    #end
26</div>
27
28<script type="text/javascript">
29    AUI().ready(
30    'aui-carousel',
31    function(A) {
32        var component = new A.Carousel(
33            {
34                activeIndex: 'rand',
35                contentBox: '#$contentClass',
36                height: $height.getData(),
37                intervalTime: $duration.getData(),
38                width: $width.getData()
39            }
40        )
41        .render();
42    });
43</script>
Armando Ponce
RE: Carousel portlet
16 maggio 2011 9.11
Risposta

Armando Ponce

Punteggio: New Member

Messaggi: 8

Data di Iscrizione: 16 maggio 2011

Messaggi recenti

In Liferay 5.1.7 there is no Alloy UI, is it? I think the way to go is with Jquery.
Nilesh Gundecha
RE: Carousel portlet
17 maggio 2011 0.40
Risposta

Nilesh Gundecha

Punteggio: Regular Member

Messaggi: 196

Data di Iscrizione: 30 novembre 2009

Messaggi recenti

I tried using the Alloy UI and could successfully achieve it. But the problem what I faced was that every time my portal page use to get refreshed, the Carousel use to get reloaded. And whenever the Carousel gets reloaded, it displays all the <div>'s for few seconds and then starts its carousel effect. I want to avoid this. Is there any way I can configure this?

Thanks and Regards,
Nilesh.
Oliver Bayer
RE: Carousel portlet
17 maggio 2011 1.10
Risposta

Oliver Bayer

Punteggio: Liferay Master

Messaggi: 883

Data di Iscrizione: 18 febbraio 2009

Messaggi recenti

Hi Nilesh,

I don't think you can avoid this "feature". It all depends on your network connection speed because the page has to be completely loaded before the carousel script is run. So all html has to be loaded before the js effect can start and redisplay the carousel contents. Testing it at localhost you shouldn't see the divs.

HTH Oli
Nilesh Gundecha
RE: Carousel portlet
17 maggio 2011 1.22
Risposta

Nilesh Gundecha

Punteggio: Regular Member

Messaggi: 196

Data di Iscrizione: 30 novembre 2009

Messaggi recenti

Hi Oliver,

Many Thanks for your reply. But I dont see this to be a network connection speed problem. As I am not facing the same problem when I am surfing the liferay.com. As we know in liferay.com, on its home page itself, Alloy Carousel is used where different images are embedded inside the div are is carousel effect.

But while surfing this, I am not facing any problem. There is no reloading delay which makes all the content to be seen first, and then effect.

I am facing problem in my local system itself. I will post my code here.

Regards,
Nilesh.
gofri _
RE: Carousel portlet
17 maggio 2011 2.03
Risposta

gofri _

Punteggio: Junior Member

Messaggi: 92

Data di Iscrizione: 2 marzo 2007

Messaggi recenti

hi, try to position your divs to overlap each other
Christopher Jimenez
RE: Carousel portlet
30 gennaio 2012 10.15
Risposta

Christopher Jimenez

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 23 dicembre 2011

Messaggi recenti

I dont want to have all the information in the same web content... I like to do the same but web content with a special tag or categories
Mika Koivisto
RE: Carousel portlet
22 agosto 2012 20.26
Risposta

Mika Koivisto

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1505

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

Just thought I'd let everyone know that I recently made a photo carousel portlet that uses Alloy UI carousel which you can quite conveniently configure and it pulls the images from Document's and Media.
Matus Ferko
RE: Carousel portlet
4 settembre 2012 12.59
Risposta

Matus Ferko

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 5 giugno 2009

Messaggi recenti

Mika I am not able to build the portlet with build-css goal enabled
1<executions>
2        <execution>
3            <phase>generate-sources</phase>
4                <goals>
5                    <goal>build-css</goal>
6                </goals>
7        </execution>
8    </executions>


Edit 1:
I use plugin version 6.1.1
I receive error
Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.1.1:build-css (default) on project photo-carousel-portlet: basedir C:\...\photo-carousel-portlet\target\photo-carousel-portlet-0.1-SNAPSHOT does not exist. -> [Help 1]
Mika Koivisto
RE: Carousel portlet
4 settembre 2012 11.46
Risposta

Mika Koivisto

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1505

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

It requires 6.1.1 or 6.1.20 version of the Liferay maven plugin which has the build-css goal.
Hans-Jörg Alles
RE: Carousel portlet
11 gennaio 2013 5.12
Risposta

Hans-Jörg Alles

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 30 maggio 2012

Messaggi recenti

Hello Mika,

i tried your photo portlet. It have everything on board i need, thank you very much.
But could it be, that if you enable link and store url per picture, that this works ( mouse / hyperlink ) in FF but not in IE 8 ?

Greatings

Hans-Jörg
Valérie barbot
RE: Carousel portlet
12 dicembre 2013 6.52
Risposta

Valérie barbot

Punteggio: Junior Member

Messaggi: 72

Data di Iscrizione: 7 aprile 2009

Messaggi recenti

photo carousel portlet is very useful. i have a problem with rights because guest must not view the folder but only access. i have the error :

Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 29
thanks