[opencms-dev] News etc. in Breadcrumbs

Feuerstein Andreas andreas.feuerstein at solvistas.at
Sun Sep 18 21:24:55 CEST 2011


Hi Kai,

thanks for this code. Unfortunately it doesn't seem to work for News. What I would like to link in the breadcrumbs is the news' title.

Best regards,
Andreas


-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org im Auftrag von Schliemann, Kai
Gesendet: Fr 16.09.2011 11:47
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] News etc. in Breadcrumbs
 
Hi Andreas,

this is a code snippet from a breadcrumb.jsp used in an OpenCms 7.5.2 project. I don't know if it works in 8 but it should be quite similar:

 

 

<%@page import="org.opencms.frontend.templatetwo.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"%>

<% 

    // This element defines breadcrumb navigation.

    //

                // It uses the CmsTemplateMenu class to provide some auxiliary methods

                // in order to prevent the use of scriplet code in this jsp.

                // For details on the CmsTemplateMenu class, see the source code which can

                // be found at the followinf VFS location:

                // /system/modules/org.opencms.frontend.templatetwo/java_src/CmsTemplateMenu.java

 

                CmsTemplateMenu cms = new CmsTemplateMenu(pageContext, request, response);

                pageContext.setAttribute("cms", cms);

                int navStartLevel = Integer.parseInt(cms.property("NavStartLevel", "search", "0") + 1);

                pageContext.setAttribute("navList", cms.getNavigation().getNavigationBreadCrumb(navStartLevel, true));

%>

Sie befinden sich hier: 

<c:set var="first" value="true" />

<c:forEach items="${navList}" var="elem" >

                <c:if test="${!empty cms.navText[elem]}">

                               <c:if test="${!first}"> » </c:if>

                               <a href="<cms:link>${elem.resourceName}</cms:link>">${cms.navText[elem]}</a>

                               <c:set var="first" value="false" />

                </c:if>

</c:forEach>

 

<c:if test="${!cms.isDefault || first}">

                <c:set var="navText"><cms:property name="NavText" /></c:set>

                <c:if test="${empty navText}">

                               <c:set var="navText"><cms:property name="Title" /></c:set>

                </c:if>

                <c:if test="${!empty navText}">

                               <c:if test="${!first}">

                                                » 

                               </c:if>

                               <c:out value="${navText}" />

                </c:if>

</c:if>

 

HTH

 

Regards

 

Kai

 

Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Feuerstein Andreas
Gesendet: Freitag, 16. September 2011 09:41
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] News etc. in Breadcrumbs

 

Sorry for spamming - does anyone have an idea on this?

Regards,
Andreas


-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org im Auftrag von Feuerstein Andreas
Gesendet: Mi 14.09.2011 10:17
An: opencms-dev at opencms.org
Betreff: [opencms-dev] News etc. in Breadcrumbs

Hi,

when viewing the Template 3 Demo Content (Flowers) and I click on any news in the News Box on the right hand side, the news is opening. Unfortunately this news isn't shown in the breadcrumbs.

Does anyone have a solution how I can add the news' (or any content types') title to the breadcrumbs?

Best Regards,
Andreas

________________________________

eMail ist virenfrei.
Von AVG überprüft - www.avg.de
Version: 10.0.1410 / Virendatenbank: 1520/3899 - Ausgabedatum: 15.09.2011 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110918/a0c4dfd0/attachment.htm>


More information about the opencms-dev mailing list