Before I give up entirely on my programming skills this afternoon, one more shot at working code:

<c:set var="linkUrl"><jsp:expression>request.getContextPath() +
info.magnolia.cms.util.Resource.getCurrentActivePage( request ).getHandle()</jsp:expresson>.html</c:set>

<cms:setNode var="pageProps" />

<a href="${linkUrl}>${pageProps.title}</a>

It's been a long afternoon.....


--David

David Smith wrote:

I should clarify slightly that you'll want to use .getCurrentActivePage(request).getHandle() for page level URLs. getLocalContentNode() returns the path to the paragraph. That's my fault for using the wrong method in the example code.

The simplest way to write the title of a page is just <c:out nodeDataName="title" /> or <c:out nodeDataName="contentTitle" />

In my templates, I used <cms:setNode var="pageProperties" scope="request"/> in the main template and it gives me access to the page level nodeData in all the sub templates. Just needed to do ${pageProperties.title} to get the page's title or ${pageProperties.contentTitle} for the title to display on a page. It allowed me to modularize things a bit.

--David

Nils Oldenburg wrote:


Am 11.04.2007 um 21:43 schrieb David Smith:

Oops... extra parenthesis in the code I posted. What's quoted below is accurate.

David Smith wrote:

In general any node is referred to with the .getHandle() method as in:

<jsp:expression>request.getContextPath() +
info.magnolia.cms.util.Resource.getLocalContentNode ( request ).getHandle()</jsp:expresson>.html


--David



Thx , that's it ! but...if i think about it this means that <a href="$ {pageContext.request.contextPath}/Page.html">Page</a> is hardwired in the template. if i want to access the title directly i.e. instead of "Page" (in German "Kontakt", in english "Contact"), then is the upper syntax right ? in this moment, i can't test it, sorry

Nils


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------



----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------



----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to