Forums de discussion

liferay command in javascript

Toshiro Mifune, modifié il y a 8 années.

liferay command in javascript

Regular Member Publications: 238 Date d'inscription: 11/12/14 Publications récentes
Hi all,

how to write a liferay commands in javascript? For example ...

#if ($layout.getName($w3c_language_id) == "contact")
thumbnail
M J, modifié il y a 8 années.

RE: liferay command in javascript

Regular Member Publications: 184 Date d'inscription: 01/03/13 Publications récentes
Liferay command?
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: liferay command in javascript

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Toshiro, that's velocity, not JS. Velocity has different syntax, runs on the server, etc.

Rather than trying to lead us to what you are trying to figure out it's often best to come right out and say "How can I do X?"
Toshiro Mifune, modifié il y a 8 années.

RE: liferay command in javascript

Regular Member Publications: 238 Date d'inscription: 11/12/14 Publications récentes
I did mean ... I have writen few lines oc code and what I want to do is write it only in javascript

Code

#if ($layout.getName($w3c_language_id) == "Company")
<script type="text/javascript">
			removeItems();
	        $("#sddm a").removeClass("menuCSSlbl");
			$( "#m1p a" ).addClass("menuCSSlbl");
	    	$("#sddm div a").removeClass("menuCSSlbl");
</script>
#end

So I tried to edit first line like this

document.write( " #if ($layout.getName($w3c_language_id) == \"Company\") " )

but it works only if I put it into a vm file => if I put this into a js file, it doesnt work ... how to overwrite it ?