フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Gurumurthy Godlaveeti
How to provide images using velocity template ?
2012/09/03 14:49
答え

Gurumurthy Godlaveeti

ランク: Regular Member

投稿: 209

参加年月日: 2011/08/11

最近の投稿

Hello There ,
I used velocity basic variables to get content or to link with other page also . but i am unable to get image using the below template code .

My Structure code is
1<root>
2  <dynamic-element name='CSS' type='text_box' index-type='' repeatable='false'></dynamic-element>
3  <dynamic-element name='javascript' type='text_box' index-type='' repeatable='false'></dynamic-element>
4  <dynamic-element name='pages' type='link_to_layout' index-type='' repeatable='true'>
5    <dynamic-element name='images' type='image' index-type='' repeatable='false'></dynamic-element>
6  </dynamic-element>
7</root>


And Template code is
 1
 2<style type="text/css">
 3    $CSS.getData()
 4</style>
 5<script type="text/javascript" >
 6    $javascript.getData()
 7</script>
 8
 9<figure>
10    <div class="rslides_container">
11        <ul class="rslides" id="slider1">
12            #foreach($currentPage in $pages.getSiblings())
13                <li>
14                    <a href="#$currentPage.getUrl()" >
15                        <img src="$currentPage.getChildren().getUrl()" alt="" />
16                    </a>
17                </li>
18            #end
19        </ul>
20    </div>
21</figure>


I got below error , is any thing is wrong ?

Current URL /web/securus/$currentPage.getChildren().getUrl() generates exception: null
Satheesh Ravi
RE: How to provide images using velocity template ?
2012/09/03 16:05
答え

Satheesh Ravi

ランク: Junior Member

投稿: 35

参加年月日: 2011/11/24

最近の投稿

Hi,

Image gallery is the better way of adding image. You can use the following

<dynamic-element name='test' type='image_gallery' index-type='' repeatable='false'></dynamic-element>

$test.data would give the image path which can be used as image source.
mehdi sunasara
RE: How to provide images using velocity template ?
2013/04/26 2:27
答え

mehdi sunasara

ランク: Junior Member

投稿: 26

参加年月日: 2012/09/12

最近の投稿

Still doesnt work for me
James Falkner
RE: How to provide images using velocity template ?
2013/04/26 8:34
答え

James Falkner

Community Moderator

ランク: Liferay Legend

投稿: 1406

参加年月日: 2010/09/17

最近の投稿

Gurumurthy Godlaveeti:
Hello There ,
I used velocity basic variables to get content or to link with other page also . but i am unable to get image using the below template code .

My Structure code is
1<root>
2  <dynamic-element name='CSS' type='text_box' index-type='' repeatable='false'></dynamic-element>
3  <dynamic-element name='javascript' type='text_box' index-type='' repeatable='false'></dynamic-element>
4  <dynamic-element name='pages' type='link_to_layout' index-type='' repeatable='true'>
5    <dynamic-element name='images' type='image' index-type='' repeatable='false'></dynamic-element>
6  </dynamic-element>
7</root>


And Template code is
 1
 2<style type="text/css">
 3    $CSS.getData()
 4</style>
 5<script type="text/javascript" >
 6    $javascript.getData()
 7</script>
 8
 9<figure>
10    <div class="rslides_container">
11        <ul class="rslides" id="slider1">
12            #foreach($currentPage in $pages.getSiblings())
13                <li>
14                    <a href="#$currentPage.getUrl()" >
15                        <img src="$currentPage.getChildren().getUrl()" alt="" />
16                    </a>
17                </li>
18            #end
19        </ul>
20    </div>
21</figure>


I got below error , is any thing is wrong ?

Current URL /web/securus/$currentPage.getChildren().getUrl() generates exception: null


Instead of

<img src="$currentPage.getChildren().getUrl()" alt="" />

try

<img src="$currentPage.images.data" alt="" />


Notice the more compact way of accessing children and their fields.
mehdi sunasara
RE: How to provide images using velocity template ?
2013/04/26 22:03
答え

mehdi sunasara

ランク: Junior Member

投稿: 26

参加年月日: 2012/09/12

最近の投稿

Thnx it is working
Mohammad Azharuddin
RE: How to provide images using velocity template ?
2013/04/26 22:11
答え

Mohammad Azharuddin

ランク: Liferay Master

投稿: 504

参加年月日: 2012/09/17

最近の投稿

This may be helpfull wiki