Re: Container Path
Philippe Vollenweider <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.template |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm not sure to understand what you need.
The search result can return a JahiaPage with thisHit.page()
Then you can construct the full path with such method:
public String getPath (JahiaPage link, JahiaData jData)
throws JahiaException
{
if (link == null){
return "";
}
int linkPID = -1;
StringBuffer fullPath = new StringBuffer();
JahiaPage aPage;
int count = 0;
if (link.getPageType() == 0) {
linkPID = link.getID();
} else if (link.getPageType() == 1) {
linkPID = link.getPageLinkID();
}
if (linkPID != -1){
ContentPage contentPage = ContentPage.getPage(linkPID);
Enumeration thePath =
contentPage.getPagePath(jData.params().getEntryLoadRequest(),
jData.params().getOperationMode(),
jData.params().getUser());
while (thePath.hasMoreElements()) {
aPage = (JahiaPage) thePath.nextElement();
if (aPage != null) {
count++;
if (count > 1){
fullPath.append(" / ");
}
fullPath.append("<a href=\"");
fullPath.append(aPage.getURL(jData.params()));
fullPath.append("\">");
fullPath.append(aPage.getTitle());
fullPath.append("</a>");
}
}
}
if (fullPath.length() > 0) {
fullPath.insert(0, "(");
fullPath.append(")");
}
return fullPath.toString();
}
I hope it can help you.
Cheers,
Philippe
At 19.07.2004 11:39, you wrote:
>Hi!
>I should display the container search results in the way that path to the
>found container should be included in search result.
>Eg: /topis/music/classic/Bach if I search for 'Bach'
>Is it possible somehow to retrieve the path (The parent containers) to the
>container without writing own proceudre for each result to compose the
>path from DB.
>
>With Kind regards
>Alex
>
>__________
>www.newmail.ru -- ×ÓÅÇÄÁ ÞÔÏ-ÔÏ ÎÏ×ÏÅ.
-------=[ pvollenweider at jahia dot com ]=---------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company