Fórumok

Breadcrumb trail

neelam bhandari, módosítva 12 év-val korábban

Breadcrumb trail

Regular Member Bejegyzések: 102 Csatlakozás dátuma: 2011.08.16. Legújabb bejegyzések
Hi,

Is it possible to show only text not url for the current page in breadcrumb trail?

Regards
Neelam Bhandari
thumbnail
Josef Šustáček, módosítva 12 év-val korábban

RE: Breadcrumb trail

New Member Bejegyzések: 22 Csatlakozás dátuma: 2009.10.05. Legújabb bejegyzések
Hi,

I don't know whether there is some setting for it (doubt it), so I just grepped the source code and found out that breadcrumbs are generated via Velocity macro -> theme.getBreadcrumTag() -> breadcrumb tag (with default settings) from liferay-ui taglib.

So if you are comfortable with modifiing Liferay sources, try to look at files init.jsp and display_style_1.jsp in folder :

portal-web/docroot/html/taglib/ui/breadcrumb/


try to find where link for current page is generated and update the code to be just a plain text.
neelam bhandari, módosítva 12 év-val korábban

RE: Breadcrumb trail

Regular Member Bejegyzések: 102 Csatlakozás dátuma: 2011.08.16. Legújabb bejegyzések
Hi ,
Many thanks for your reply. I was exactly trying the same . I did change init.jsp but nothing much happened

private void _buildPortletBreadcrumb(HttpServletRequest request, StringBundler sb) throws Exception {
List<KeyValuePair> portletBreadcrumbList = PortalUtil.getPortletBreadcrumbList(request);

if (portletBreadcrumbList == null) {
return;
}


for (KeyValuePair kvp : portletBreadcrumbList) {
if(kvp== getLast(portletBreadcrumbList)){
String breadcrumbText = kvp.getKey();
sb.append("<li><span>");
sb.append(HtmlUtil.escape(breadcrumbText));
sb.append("</span></li>");
}else{

String breadcrumbText = kvp.getKey();
String breadcrumbURL = kvp.getValue();

sb.append("<li><span>");

if (Validator.isNotNull(breadcrumbURL)) {
sb.append("<a href=\"");
sb.append(HtmlUtil.escape(breadcrumbURL));
sb.append("\">");
}

sb.append(HtmlUtil.escape(breadcrumbText));

if (Validator.isNotNull(breadcrumbURL)) {
sb.append("</a>");
}

sb.append("</span></li>");
}
}
}
KeyValuePair getLast(List<KeyValuePair> list) { return list.get(list.size() -1); }



I guess i need to change some other method in init.jsp.
If you come across some solution then kindly let me know
Regards
Neelam Bhandari
neelam bhandari, módosítva 12 év-val korábban

RE: Breadcrumb trail

Regular Member Bejegyzések: 102 Csatlakozás dátuma: 2011.08.16. Legújabb bejegyzések
Hi,
Waiting reply from Liferay Team. Is there any way to achieve this in the current system?

Thanks
Neelam
thumbnail
Tejas Kanani, módosítva 12 év-val korábban

RE: Breadcrumb trail

Liferay Master Bejegyzések: 654 Csatlakozás dátuma: 2009.01.06. Legújabb bejegyzések
Hi Neelam,

Try out below change.

In display_style_1.jsp there is a method _buildLayoutBreadcrumb(). In that method modify below lines of code

StringBundler breadcrumbSB = new StringBundler(7);

breadcrumbSB.append("<li><span><a href=\"");
breadcrumbSB.append(layoutURL);
breadcrumbSB.append("\" ");
breadcrumbSB.append(target);
breadcrumbSB.append(">");

breadcrumbSB.append(HtmlUtil.escape(selLayout.getName(themeDisplay.getLocale())));

breadcrumbSB.append("</a></span></li>");


with

StringBundler breadcrumbSB = new StringBundler(7);

breadcrumbSB.append("<li><span>");
breadcrumbSB.append(HtmlUtil.escape(selLayout.getName(themeDisplay.getLocale())));
breadcrumbSB.append("</span></li>");


Now it will not display pages with the link. It will display only page title as a text format.

I hope that is what you are looking for.

Regards,
Tejas Kanani
Deploy Liferay to Jelastic Cloud
neelam bhandari, módosítva 12 év-val korábban

RE: Breadcrumb trail

Regular Member Bejegyzések: 102 Csatlakozás dátuma: 2011.08.16. Legújabb bejegyzések
Hi Tejas ,
Many thanks for your reply. I did try this solution yesterday .It does solve problem for the main page but for child (also hidden) pages I want url for the parent page in the bread crumb and not for the child one. In short I want text only for the last(current) page in the breadcrumb trail. This solution removes url from all the pages.

If you have further ideas regarding this problem kindly let me know.

Cheers
Neelam Bhandari
thumbnail
Tejas Kanani, módosítva 12 év-val korábban

RE: Breadcrumb trail

Liferay Master Bejegyzések: 654 Csatlakozás dátuma: 2009.01.06. Legújabb bejegyzések
Here you go !!!

Below is the modified _buildLayoutBreadcrumb() method as per your needs. Now it will display all the parent pages with link and child page(last page) will not have link in breadcrumb.

private void _buildLayoutBreadcrumb(Layout selLayout, String selLayoutParam, PortletURL portletURL, ThemeDisplay themeDisplay, boolean selectedLayout, StringBundler sb) throws Exception {
	String layoutURL = _getBreadcrumbLayoutURL(selLayout, selLayoutParam, portletURL, themeDisplay);
	String target = PortalUtil.getLayoutTarget(selLayout);

	StringBundler breadcrumbSB = new StringBundler(7);

	[b]if(selLayout.hasChildren())
	{
		breadcrumbSB.append("<li><span><a href="\&quot;&quot;);" breadcrumbsb.append(layouturl); breadcrumbsb.append("\" "); breadcrumbsb.append(target); breadcrumbsb.append(">");

		breadcrumbSB.append(HtmlUtil.escape(selLayout.getName(themeDisplay.getLocale())));

		breadcrumbSB.append("</a></span></li>");
	}
	else
	{
		breadcrumbSB.append("<li><span>");
		breadcrumbSB.append(HtmlUtil.escape(selLayout.getName(themeDisplay.getLocale())));
		breadcrumbSB.append("</span></li>");
	}[/b]

	if (selLayout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
		Layout layoutParent = LayoutLocalServiceUtil.getLayout(selLayout.getGroupId(), selLayout.isPrivateLayout(), selLayout.getParentLayoutId());

		_buildLayoutBreadcrumb(layoutParent, selLayoutParam, portletURL, themeDisplay, false, sb);

		sb.append(breadcrumbSB.toString());
	}
	else {
		sb.append(breadcrumbSB.toString());
	}
}


Let me know if it will not work for you.

Regards,
Tejas Kanani
Deploy Liferay to Jelastic Cloud
neelam bhandari, módosítva 12 év-val korábban

RE: Breadcrumb trail

Regular Member Bejegyzések: 102 Csatlakozás dátuma: 2011.08.16. Legújabb bejegyzések
Hi Tejas,
Thanks a ton for the solution.I will try this and come back to you.
Cheers
Neelam Bhandari
surendrababu challa, módosítva 12 év-val korábban

RE: Breadcrumb trail

New Member Bejegyzések: 12 Csatlakozás dátuma: 2012.03.14. Legújabb bejegyzések
hi,

I have the sam problem.

I used ur code but I am getting console error
ERROR [IncludeTag:154] org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 31 in the jsp file: /html/taglib/ui/breadcrumb/display_style_horizontal.jsp
The method _buildLayoutBreadcrumb(Layout, String, PortletURL, ThemeDisplay, boolean, StringBundler) in the type display_005fstyle_005fhorizontal_jsp is not applicable for the arguments (Layout, String, boolean, PortletURL, ThemeDisplay, StringBundler)
28: }
29:
30: if (showLayout) {
31: _buildLayoutBreadcrumb(selLayout, selLayoutParam, true, portletURL, themeDisplay, sb);
32: }

please suggest any solution
thumbnail
Tejas Kanani, módosítva 12 év-val korábban

RE: Breadcrumb trail

Liferay Master Bejegyzések: 654 Csatlakozás dátuma: 2009.01.06. Legújabb bejegyzések
Hi surendrababu challa,

looks like there is some error in your jsp file.
Can you please attach your jsp file here OR paste the code. That will be easy for others to easily get into the exact issue.
thumbnail
Brian Scott Schupbach, módosítva 11 év-val korábban

RE: Breadcrumb trail

Expert Bejegyzések: 329 Csatlakozás dátuma: 2008.10.23. Legújabb bejegyzések
You can also use

#breadcrumbs()

In your velocity template file.
thumbnail
Amruta Naidu, módosítva 10 év-val korábban

RE: Breadcrumb trail

New Member Bejegyzések: 12 Csatlakozás dátuma: 2013.04.24. Legújabb bejegyzések
Hi Tejas....

I used the above code reference to modify my init.jsp in html/taglib/ui/breadcrumb/init.jsp. according to my requirement.
My Requirement:
the breadcrumb should be as follows and multilingual :
(Guest Site) > (<a>Parent Page</a>) > (Current Page)
I also achieved this using liferay 6.1.
Recently i have migrated to liferay 6.2, and in html/taglib/ui/breadcrumb there is no previous version code. Do you have any idea where the breadcrumb related jsp s are?
and how should i proceed in LR 6.2 for my requirement.

Thanks.

Mellékletek:

thumbnail
M J, módosítva 10 év-val korábban

RE: Breadcrumb trail

Regular Member Bejegyzések: 184 Csatlakozás dátuma: 2013.03.01. Legújabb bejegyzések
Try tomcat-7.0.42\webapps\ROOT\html\portlet\breadcrumb or tomcat-7.0.42\webapps\ROOT\html\taglib\ui\breadcrumb
for breadcrumb portlet JSPs.
pandiyan arumugam, módosítva 8 év-val korábban

RE: Breadcrumb trail

New Member Bejegyzések: 8 Csatlakozás dátuma: 2015.07.03. Legújabb bejegyzések
Hi All,

Recently i have migrated to liferay 6.2 and no code change in html/taglib/ui/breadcrumb. But while accessing ui getting below Errror in server.log.


Error:-


21:09:19,996 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[jsp]] () Servlet.service() for servlet jsp threw exception: org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 197 in the jsp file: /html/taglib/ui/breadcrumb/init.jsp
Cannot make a static reference to the non-static method getPortletDisplay() from the type ThemeDisplay
194: }
195:
196: if (!showCurrentPortlet) {
197: PortletDisplay portletDisplay = ThemeDisplay.getPortletDisplay();
198:
199: String portletTitle = PortalUtil.getPortletTitle(portletDisplay.getId(), themeDisplay.getUser());
200:


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrap