掲示板

How to provide images using velocity template ?

thumbnail
11年前 に Gurumurthy Godlaveeti によって更新されました。

How to provide images using velocity template ?

Regular Member 投稿: 208 参加年月日: 11/08/12 最新の投稿
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
<root>
  <dynamic-element name="CSS" type="text_box" index-type="" repeatable="false"></dynamic-element>
  <dynamic-element name="javascript" type="text_box" index-type="" repeatable="false"></dynamic-element>
  <dynamic-element name="pages" type="link_to_layout" index-type="" repeatable="true">
    <dynamic-element name="images" type="image" index-type="" repeatable="false"></dynamic-element>
  </dynamic-element>
</root>


And Template code is

<style type="text/css">
	$CSS.getData()
</style>
<script type="text/javascript">
	$javascript.getData()
</script>

<figure>
    <div class="rslides_container">
		<ul class="rslides" id="slider1">
			#foreach($currentPage in $pages.getSiblings())
				<li>
					<a href="#$currentPage.getUrl()">
						<img src="$currentPage.getChildren().getUrl()" alt="">
					</a>
				</li>
			#end
		</ul>
	</div>
</figure>


I got below error , is any thing is wrong ?

Current URL /web/securus/$currentPage.getChildren().getUrl() generates exception: null
11年前 に Satheesh Ravi によって更新されました。

RE: How to provide images using velocity template ?

Junior Member 投稿: 35 参加年月日: 11/11/25 最新の投稿
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.
10年前 に mehdi sunasara によって更新されました。

RE: How to provide images using velocity template ?

Junior Member 投稿: 26 参加年月日: 12/09/12 最新の投稿
Still doesnt work for me
thumbnail
10年前 に James Falkner によって更新されました。

RE: How to provide images using velocity template ?

Liferay Legend 投稿: 1399 参加年月日: 10/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
<root>
  <dynamic-element name="CSS" type="text_box" index-type="" repeatable="false"></dynamic-element>
  <dynamic-element name="javascript" type="text_box" index-type="" repeatable="false"></dynamic-element>
  <dynamic-element name="pages" type="link_to_layout" index-type="" repeatable="true">
    <dynamic-element name="images" type="image" index-type="" repeatable="false"></dynamic-element>
  </dynamic-element>
</root>


And Template code is

<style type="text/css">
	$CSS.getData()
</style>
<script type="text/javascript">
	$javascript.getData()
</script>

<figure>
    <div class="rslides_container">
		<ul class="rslides" id="slider1">
			#foreach($currentPage in $pages.getSiblings())
				<li>
					<a href="#$currentPage.getUrl()">
						<img src="$currentPage.getChildren().getUrl()" alt="">
					</a>
				</li>
			#end
		</ul>
	</div>
</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.
10年前 に mehdi sunasara によって更新されました。

RE: How to provide images using velocity template ?

Junior Member 投稿: 26 参加年月日: 12/09/12 最新の投稿
Thnx it is working
thumbnail
10年前 に mohammad azaruddin によって更新されました。

RE: How to provide images using velocity template ?

Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿
This may be helpfull wiki