掲示板
Image path in Javascript
how to specify the image path in Javascript from Liferay
abcd.js
abcd.js
var A_TCALDEF = {
'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
'yearscroll': true, // show year scroller
'weekstart': 0, // first day of week: 0-Su or 1-Mo
'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
[b]'imgpath' : '../img/'[/b] // directory with calendar images
}
12年前 に Advait Trivedi によって更新されました。
RE: Image path in Javascript
Junior Member 投稿: 56 参加年月日: 10/03/30 最新の投稿
Hi Pieter,
IMHO both the options are OK -
1. an absolute path with theme context "/mytheme/img/myimg.jpg"
2. also a relative path - "../img/myimg.jpg". Note here that path is relative to the JS file.
I am not sure if any one of the above is preferred by Liferay gurus.
Best,
Advait
IMHO both the options are OK -
1. an absolute path with theme context "/mytheme/img/myimg.jpg"
2. also a relative path - "../img/myimg.jpg". Note here that path is relative to the JS file.
I am not sure if any one of the above is preferred by Liferay gurus.
Best,
Advait
12年前 に Samir Gami によって更新されました。
RE: Image path in Javascript
Regular Member 投稿: 162 参加年月日: 11/02/04 最新の投稿
Pieter,
You can use absolute path with the javaScript, like
"/Test-portlet/img/myImage.jpg" [ /{Portlet-Name}/img/{imageName} ]
You can use absolute path with the javaScript, like
"/Test-portlet/img/myImage.jpg" [ /{Portlet-Name}/img/{imageName} ]
11年前 に Rupesh Chotai によって更新されました。
RE: Image path in Javascript
Regular Member 投稿: 163 参加年月日: 11/03/23 最新の投稿
Hi Samir,
I was looking for the same issue where I have to get the image path in js file and your suggestion worked.
Thanks.
I was looking for the same issue where I have to get the image path in js file and your suggestion worked.
Thanks.
12年前 に Amos Fong によって更新されました。
RE: Image path in Javascript
Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
I think you can use the themeDisplay javascript object:
themeDisplay.getPathThemeImages()
Should return something like:
/test-theme/images
themeDisplay.getPathThemeImages()
Should return something like:
/test-theme/images