Forums de discussion

Template asset publisher

thumbnail
Soukaina HAJI, modifié il y a 9 années.

Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
Hello,

I want to make this template work :
<table>
<tbody><tr>
<td style="padding: 0 0 0 0;">
<h3 style="margin: 0 0 0 0;"> <span>$reserved-article-title.getData()</span></h3>
<span>$content.getData()</span>
<br>
#if ($image.getData()!="") 
<img src="$image.data" width="150"><br>
#end 
#foreach($temp in $url.siblings)
#if ($lien.data!="") 
    <a target="_blank" href="$temp.data">$temp.data</a><br>
#end
#end
</td>
</tr>
</tbody></table>


It shows the following :


If it's possible a sample template to help me out
Liferay 6.2 ce ga2
thank you
Anonymous Anonymous, modifié il y a 9 années.

RE: Template asset publisher (Réponse)

Regular Member Publications: 127 Date d'inscription: 16/09/19 Publications récentes
Hello

I have attached structure and template copy ....it may help you,its in working condition u can just place the structure and template in proper place and check it


Thank You
........
thumbnail
Soukaina HAJI, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
Thanks a loot,
It's working now , but I want to display the image in the first page :



it seems to me like it can't read html code !!

tempalte:

<table>
<tbody><tr>
<td style="padding: 0 0 0 0;">
<h3 style="margin: 0 0 0 0;"> <span>$reserved-article-title.getData()</span></h3>
<span>$content.getData()</span>
<br>
#if (!$image.isEmpty())
    <img src="$image.getData()" width="150"><br>
#end 
</td>
</tr>
</tbody></table>
Anonymous Anonymous, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 127 Date d'inscription: 16/09/19 Publications récentes
Hi soukaina


Check this ...it will work fine to display the image


Thank You
thumbnail
Soukaina HAJI, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
Yes It display the image but after clicking on Read More ,
Why I said it doesn't recognize html code is because even though the title is between h3 valise it display it normally ...

thank you
Anonymous Anonymous, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 127 Date d'inscription: 16/09/19 Publications récentes
Hi soukaina

Its recognizing the HTML come ,there is no issue in that ,i have attached a scrrenshot u can see my name under h3 tag.
thumbnail
Soukaina HAJI, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
hmmmm I see , I dnt know why It not working for me though the structure and template are the same as what u've sent me..

this is the template:
<table>
<tbody><tr>
<td style="padding: 0 0 0 0;">
<h3 style="margin: 0 0 0 0;"> <span>$reserved-article-title.getData()</span></h3>
<span>$content.getData()</span>
<br>
#if (!$image.isEmpty())
    <img src="$image.getData()" height="120" width="150"><br>
#end
#foreach($temp in $url.siblings)
    #if ($lien.data!="") 
        <a target="_blank" href="$temp.data">$temp.data</a><br>
    #end
#end
</td>
</tr>
</tbody></table>


and the structure:

<root available-locales="en_US" default-locale="en_US">
	<dynamic-element datatype="string" indextype="keyword" name="content" readonly="false" repeatable="false" required="false" showlabel="true" type="textarea" width="small">
		<meta-data locale="en_US">
			<entry name="label">
				content
			</entry>
			<entry name="predefinedValue">
				
			</entry>
			<entry name="tip">
				
			</entry>
		</meta-data>
	</dynamic-element>
	<dynamic-element datatype="string" indextype="keyword" name="Texte4662" readonly="false" repeatable="false" required="false" showlabel="true" type="text" width="small">
		<meta-data locale="en_US">
			<entry name="label">
				url
			</entry>
			<entry name="predefinedValue">
				
			</entry>
			<entry name="tip">
				
			</entry>
		</meta-data>
	</dynamic-element>
	<dynamic-element datatype="image" fieldnamespace="wcm" indextype="keyword" name="image" readonly="false" repeatable="false" required="false" showlabel="true" type="wcm-image" width="">
		<meta-data locale="en_US">
			<entry name="label">
				image
			</entry>
			<entry name="predefinedValue">
				
			</entry>
			<entry name="tip">
				
			</entry>
		</meta-data>
	</dynamic-element>
</root>

thnxs
Anonymous Anonymous, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 127 Date d'inscription: 16/09/19 Publications récentes
Hello

See your structure U don't have a field by name="reserved-article-title" to get the data in the template an show it in h3 tag

<dynamic-element dataType="string" indexType="keyword" name="reservearticletitle" readOnly="false" repeatable="false" required="false" showLabel="true" type="textarea" width="small">
<meta-data locale="en_US">
<entry name="label">
<![CDATA[Title]]>
</entry>
<entry name="predefinedValue">
<![CDATA[]]>
</entry>
<entry name="tip">
<![CDATA[]]>
</entry>
</meta-data>
</dynamic-element>

place the above code and get the same in template by placing <h3 style="margin: 0 0 0 0;"> <span>$reservearticletitle.getData()</span></h3>
thumbnail
Soukaina HAJI, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
Ok I found the problem:
Configuration > Display settings >
Select "full content" in "Display template"

Thank you enayath for you help and you time
thumbnail
Soukaina HAJI, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 195 Date d'inscription: 17/06/14 Publications récentes
An other question : I have some pictures I want to show which depends on the choice of select input :

	#if ($Etablissement.getData()=="CESDA")
		<img src="/documents/10179/31616/puces+intranet+CESDA.gif" height="60px" width="60px">
	#end
	#if ($Etablissement.getData()=="CSES")
		<img src="/documents/10179/31616/puces+intranet+CSES.gif" height="60px" width="60px">
	#end


The thing is I dnt know where to put this images so I can call it in src

thank you
karthik reddy, modifié il y a 9 années.

RE: Template asset publisher

Junior Member Publications: 60 Date d'inscription: 08/04/13 Publications récentes
Hi Soukaina,
You can add images directly to document and media(Add DOCUMENTS AND MEDIA portlet).Create one folder and add images.You can call this images in webcontent.
Anonymous Anonymous, modifié il y a 9 années.

RE: Template asset publisher

Regular Member Publications: 127 Date d'inscription: 16/09/19 Publications récentes
##
## This template can be used to modify the look of a specific
## application.
##
## Please use the left panel to quickly add commonly used variables.
## Autocomplete is also available and can be invoked by typing "$".
##

#set($theme_image_path = $request.get("theme-display").get("path-theme-images"))


<div class="inner_content_main_bg tab-content">
<div class="container white_bg tab-pane active" id="ceo_speaks">
#foreach ( $ent in $entries)
<div class="row-fluid">
<div class="span12">
<div class="span9 content_padding">
<div class="dotted_border"></div>
<div class="about_content">
<div class="span3">
#set($assetRenderer = $ent.getAssetRenderer())
#set($className = $ent.getAssetRenderer().getClassName())
#if( $className == "com.liferay.portlet.journal.model.JournalArticle")
#set($journalArticle = $ent.getAssetRenderer().getArticle() )
#set($document = $saxReaderUtil.read($journalArticle.getContent()))
#set($rootElement = $document.getRootElement())
#foreach($dynamicElement in $rootElement.elements())
#set($element1=$dynamicElement.attributeValue("value"))
#if ($element1=="CESDA")
#if($element=="field_name_of_image1")
<img src="$dynamicElement.element('dynamic-content').getData()" alt=""/>
#elseif($element1=="CSES")
#if($element=="field_name_of_image2")
<img src="$dynamicElement.element('dynamic-content').getData()" alt=""/>
#end
#end
</div>
#end
</div>
</div>


</div>
</div>
#end
</div>
</div>
<script>

</script>