On Jul 17, 2009, at 3:29 PM, Bert Leunis wrote:


Thanks Grégory,

If the ctx always is a Webcontext, is updating that link to http://dev.magnolia-cms.com/ref/latest-stable/apidocs/info/magnolia/context/WebContext.html a good idea?

Well, the point is that it's *not* always a WebContext. (unlike JSP, FreeMarker templates can be used in various contexts that don't have an HttpServletRequest/Response instance -- think e-mails, workflows, scheduled tasks, ...)

(I did add the link though, will update in a second)


-g


-----Original Message-----
From: [email protected] [mailto:[email protected] ] On Behalf Of Grégory Joseph
Sent: vrijdag 17 juli 2009 15:18
To: Magnolia User-List
Subject: Re: [magnolia-user] Re: getting the contextPath using freemarker


It's an instance of info.magnolia.context.Context - which in the case
of web request to a page is an info.magnolia.context.WebContext

The doc you mention provides a link to the javadoc.

Cheers,

-g

On Jul 17, 2009, at 2:04 PM, Bert Leunis wrote:


Hi Matteo,

Thanks a lot, you were spot on.
I have been looking for some documentation of this, e.g. at 
http://documentation.magnolia-cms.com/reference/templating.html
.
The ctx variable is mentioned there, but I cannot determine what
properties the ctx has. Any idea where to look?

Many regards, Bert


-----Original Message-----
From: [email protected] [mailto:[email protected]
] On Behalf Of Matteo Pelucco
Sent: vrijdag 17 juli 2009 13:47
To: [email protected]
Subject: [magnolia-user] Re: getting the contextPath using freemarker


Bert Leunis ha scritto:
Dear All,
When writing templates using JSP's I could get the context path like
this: ${pageContext.request.contextPath}.
I am looking for a way to get the contextPath using freemarker, but I
have not succeeded so far. Does anyone know how to do that?

Magnolia exposes the context object to a freemarker tpl, try using

  ${ctx.contextPath}

HTH
Matteo


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to