[opencms-dev] Opencms Navigation Modification

Phil.Launchbury at tssi.co.uk Phil.Launchbury at tssi.co.uk
Thu Jan 19 18:14:56 CET 2006


I ran into the same problem and solved it by using one of the other
property fields (Navinfo I think) as a menu level indicator. I then added
a bit of extra code (BTW - I'm not a programmer so any errors are strictly
my own or the website where I stole the bits of code from :-) ) to the
process that creates the menus as follows:
 
while (i.hasNext()) 
 {
  CmsJspNavElement ne = (CmsJspNavElement)i.next();
 
  String resource_name = ne.getResourceName();
  String menu_level = ne.getInfo();
  if (menu_level == null)
  {
   menu_level = "9";
  }
  
  // if we have a directory then make a new menu
  if ((resource_name.charAt(resource_name.length() - 1) == '/') &&
(menu_level.equals("1")))
  {
   if ((menu_open) && (menu_level.equals("1")))
   { 
    out.println(MenuEnd());
    ++menu_id;
    cell_id = 1;
    menu_bar += MenuBarDivider();
   }
   out.println(MenuStart(menu_id));
   menu_open = true;
   menu_bar += MenuBarEntry(menu_id, ne.getNavText());
  }
  else // otherwise just add the menu entry
  {
   if ((menu_open) && (menu_level.equals("2")))
   {
    out.println(MenuItem(ne.getNavText(), menu_id,
cms.link(ne.getResourceName()), cell_id));
    ++cell_id;
   }
  }
 }

That now gives me the two layers of menu - if navinfo contains 1 then it
is a top-level menu item and if it contains 2 then it appears in the
drop-down.
 
Hope this helps..
 
Cheers,
Phil.
 

Phil Launchbury
IT Manager
------------------------------------------------------
TSSI Systems Ltd,
Rutland House, Hargreaves Road,
Groundwell Industrial Estate,
Swindon, Wiltshire, SN25 5AZ,  U.K.

Tel:  +44  (0) 8450 707 898
Email: support at tssi.co.uk 
Website: www.tssi.co.uk

'Securing Business Around the World'
-------------------------------------------------------


 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of
frank.michel at gmail.com
Sent: 19 January 2006 14:04
To: joe at galway.net; opencms-dev at opencms.org
Subject: Re: [opencms-dev] Opencms Navigation Modification


Hi,
I'm looking for a similar thing:
I want to see all 1st level navigation entries and the ones that are in
the actual opened folder on the second level.
Using the getNavigationForFolder I can get the top level or all sublevel. 
But how can I get only the actual sublevel when inside?

And: how can I identify that I am on the index.html of a subfolder?
With navi.getResourceName().equals(filename)) I can verify it for other
documents but that does not work for the index.html.
Any ideas or best practices?

Thanks in advance!
 Frank




On 1/19/06, Joe Desbonnet <  <mailto:jdesbonnet at gmail.com>
jdesbonnet at gmail.com> wrote: 

You can make navigation any way you want with a few lines of script. 
Eg this will create
a bread crumb trail:

<%
{
        Iterator iter = navBuilder.getNavigationBreadCrumb().iterator();
        iter.next();
        out.write("<a href=\"" + cms.link ("/") + "\">Home</a> ");
        while (iter.hasNext()) {
                CmsJspNavElement nav = (CmsJspNavElement)iter.next();
                out.write(" > <a href=\"" +
cms.link(nav.getResourceName()) +
"\">" + nav.getNavText() + "</a> ");
        }
}
%>

Also remember that you can style LI tags any way you want with CSS --
I've even seen UL/LI being used to create horizantal tabs. 


Joe.


On 1/18/06, Colin Coolidge <colincoolidge at yahoo.com> wrote:
> I see that by default the left nav puts all the entries in <li> </li>
tags. 
> Where can I change this?
>
> looks like somewhere in here????:  <%= cms.buildNavigationLeft() %>
>
>  ________________________________
> Yahoo! Photos
>  Got holiday prints? See all the ways to get quality prints in your
hands 
> ASAP.
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
visit 
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>

_______________________________________________
This mail is sent to you from the opencms-dev mailing list 
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev




________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060119/2f918f71/attachment.htm>


More information about the opencms-dev mailing list