Foros de discusión
Seeking currentURL in CMS template
Robert Berndt, modificado hace 6 años.
Seeking currentURL in CMS template
New Member Mensajes: 4 Fecha de incorporación: 24/06/14 Mensajes recientes
I have set
journal.template.velocity.restricted.variables=
velocity.engine.restricted.variables=
in the portal-ext.properties.
Trying to get the current URL from within a CMS template. The following code retrieves nothing:
#set ($current_complete_url = $request.get("attributes").CURRENT_COMPLETE_URL)
#set ($current_url = $request.get("attributes").CURRENT_URL)
<p>Current URL : $current_url</p>
<p>Current Complete URL : $current_complete_url</p>
Is the $request parameter not available? Do I have the correct properties?
Liferay 6.1 enterprise
journal.template.velocity.restricted.variables=
velocity.engine.restricted.variables=
in the portal-ext.properties.
Trying to get the current URL from within a CMS template. The following code retrieves nothing:
#set ($current_complete_url = $request.get("attributes").CURRENT_COMPLETE_URL)
#set ($current_url = $request.get("attributes").CURRENT_URL)
<p>Current URL : $current_url</p>
<p>Current Complete URL : $current_complete_url</p>
Is the $request parameter not available? Do I have the correct properties?
Liferay 6.1 enterprise
Amos Fong, modificado hace 6 años.
RE: Seeking currentURL in CMS template
Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
Try just outputting $request first so you can see everything it has.
<p>Request: $request</p>
attributes should be in there, so then do $request.get("attributes") to narrow it down. Then I think it should be in there as CURRENT_URL: $request.get("attributes").get("CURRENT_URL").
<p>Request: $request</p>
attributes should be in there, so then do $request.get("attributes") to narrow it down. Then I think it should be in there as CURRENT_URL: $request.get("attributes").get("CURRENT_URL").
Robert Berndt, modificado hace 6 años.
RE: Seeking currentURL in CMS template
New Member Mensajes: 4 Fecha de incorporación: 24/06/14 Mensajes recientes
I've tried that. I just prints the literal string:
$request.get("attributes")
If I output $request as "request: $request"I get the string:
request: {}
I'm sure this is a simple detail I'm missing. I'm leaning toward a system setting that makes the parameters available to the CMS templates, but the two property settings I've tried are not working.
$request.get("attributes")
If I output $request as "request: $request"I get the string:
request: {}
I'm sure this is a simple detail I'm missing. I'm leaning toward a system setting that makes the parameters available to the CMS templates, but the two property settings I've tried are not working.
Danielle Ardon, modificado hace 6 años.
RE: Seeking currentURL in CMS template
Junior Member Mensajes: 37 Fecha de incorporación: 6/06/16 Mensajes recientes
Hey Robert, which 6.1 version are you using?
When I print $request in my velocity template with the same portal-ext.properties it does display a complete list of everything. I am using 6.1 ee ga3 sp5 with patch portal-60-6130.
I found some LPE/LPS tickets describing your problem:
https://issues.liferay.com/browse/LPS-32074
https://issues.liferay.com/browse/LPS-32074
perhaps you need a newer fixpack or something?
When I print $request in my velocity template with the same portal-ext.properties it does display a complete list of everything. I am using 6.1 ee ga3 sp5 with patch portal-60-6130.
I found some LPE/LPS tickets describing your problem:
https://issues.liferay.com/browse/LPS-32074
https://issues.liferay.com/browse/LPS-32074
perhaps you need a newer fixpack or something?