掲示板

Breadcrumb trail

12年前 に neelam bhandari によって更新されました。

Breadcrumb trail

Regular Member 投稿: 102 参加年月日: 11/08/16 最新の投稿
Hi,

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

Regards
Neelam Bhandari
thumbnail
12年前 に Josef Šustáček によって更新されました。

RE: Breadcrumb trail

New Member 投稿: 22 参加年月日: 09/10/05 最新の投稿
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.
12年前 に neelam bhandari によって更新されました。

RE: Breadcrumb trail

Regular Member 投稿: 102 参加年月日: 11/08/16 最新の投稿
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
12年前 に neelam bhandari によって更新されました。

RE: Breadcrumb trail

Regular Member 投稿: 102 参加年月日: 11/08/16 最新の投稿
Hi,
Waiting reply from Liferay Team. Is there any way to achieve this in the current system?

Thanks
Neelam
thumbnail
12年前 に Tejas Kanani によって更新されました。

RE: Breadcrumb trail

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
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
12年前 に neelam bhandari によって更新されました。

RE: Breadcrumb trail

Regular Member 投稿: 102 参加年月日: 11/08/16 最新の投稿
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
12年前 に Tejas Kanani によって更新されました。

RE: Breadcrumb trail

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
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
12年前 に neelam bhandari によって更新されました。

RE: Breadcrumb trail

Regular Member 投稿: 102 参加年月日: 11/08/16 最新の投稿
Hi Tejas,
Thanks a ton for the solution.I will try this and come back to you.
Cheers
Neelam Bhandari
12年前 に surendrababu challa によって更新されました。

RE: Breadcrumb trail

New Member 投稿: 12 参加年月日: 12/03/14 最新の投稿
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
12年前 に Tejas Kanani によって更新されました。

RE: Breadcrumb trail

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
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
11年前 に Brian Scott Schupbach によって更新されました。

RE: Breadcrumb trail

Expert 投稿: 329 参加年月日: 08/10/23 最新の投稿
You can also use

#breadcrumbs()

In your velocity template file.
thumbnail
10年前 に Amruta Naidu によって更新されました。

RE: Breadcrumb trail

New Member 投稿: 12 参加年月日: 13/04/24 最新の投稿
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.

添付ファイル:

thumbnail
10年前 に M J によって更新されました。

RE: Breadcrumb trail

Regular Member 投稿: 184 参加年月日: 13/03/01 最新の投稿
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.
8年前 に pandiyan arumugam によって更新されました。

RE: Breadcrumb trail

New Member 投稿: 8 参加年月日: 15/07/03 最新の投稿
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