You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jonathan Linczak <li...@hiram.edu> on 2004/08/06 15:57:47 UTC

Problems with customizing navigatio

Hi all,

I'm having a big problem trying to figure out how to customize the 
menus in Lenya for the design I created.  Here's a quick explanation:

In parallel to using Lenya to add content, I worked with a designer to 
create a really great website design.  Unfortunately, I'm finding I 
can't seem to create the proper xsl files to create the menus shown in 
the design.  I have the front page showing just the top-level nav, but 
the secondary page has this kind of nav:

High School Students
    - Admission
    - Application
    - Majors and Minors
    - Something else
Transfer Students
International Students
Adult / Continuing Education

and so on and so forth.  So, when I click on the High School Students 
link on the home page, the menu above appears, showing only the next 
level of navigation for the chosen section only.  I am doing this all 
with nested lists, and since we have so much information, I'd rather 
not display the whole menu and just choose to display: none in CSS.  Is 
there any way to do this easily?  I'm not very familiar with Lenya as I 
would like, and XSLT is not a strong suit of mine either.  Any help 
would be *greatly* appreciated.

Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Torsten Schlabach <TS...@gmx.net>.
Hi!

You can have a look here:

http://wiki.apache.org/cocoon-lenya/ApplicationLookandFeelHowto

(especially Section 3)

to get you started at all.

Unfortunately my best guess will be that you won't get around developing
some XSLT logic. But the good news is: I think what you are looking for can
be done and it can be done in a quite elegant (server based) fashion.

All you need to do is to build the XSLT logic to filter the menu entries
that you want to show in a certain situation.

Torsten

> Hi all,
> 
> I'm having a big problem trying to figure out how to customize the 
> menus in Lenya for the design I created.  Here's a quick explanation:
> 
> In parallel to using Lenya to add content, I worked with a designer to 
> create a really great website design.  Unfortunately, I'm finding I 
> can't seem to create the proper xsl files to create the menus shown in 
> the design.  I have the front page showing just the top-level nav, but 
> the secondary page has this kind of nav:
> 
> High School Students
>     - Admission
>     - Application
>     - Majors and Minors
>     - Something else
> Transfer Students
> International Students
> Adult / Continuing Education
> 
> and so on and so forth.  So, when I click on the High School Students 
> link on the home page, the menu above appears, showing only the next 
> level of navigation for the chosen section only.  I am doing this all 
> with nested lists, and since we have so much information, I'd rather 
> not display the whole menu and just choose to display: none in CSS.  Is 
> there any way to do this easily?  I'm not very familiar with Lenya as I 
> would like, and XSLT is not a strong suit of mine either.  Any help 
> would be *greatly* appreciated.
> 
> Jon
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: lenya-user-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Jonathan Linczak <li...@hiram.edu>.
On Aug 6, 2004, at 11:50 AM, Andreas Hartmann wrote:

> Ahhh, now I get your point :)
>
> I misunderstood the sentence "I'd rather not display the whole menu and
> just choose to display: none in CSS."

Sorry, I'm having a tough time getting across to people when I just 
found out about my deadline for this site.  :)

> The navigation framework marks the currently selected node with
> the current="true" attribute:
>
> <nav:node current="true"/>
>
> I guess what you have to do is create empty templates matching
> all nodes which
>
> - are not in the first level
> - don't have a "current" ancestor
> - don't have a father that has a "current" descendant
>
> <xsl:stylesheet>
>
> <xsl:import href="../../../../../xslt/navigation/menu.xsl"/>
>
> <xsl:template match="nav:node/nav:node
>           [not(ancestor-or-self::nav:node[@current = 'true']) and
>            not(..//nav:node[@current = 'true'])]"/>
>
> <xsl:template match="nav:node[@current = 'true']/*/nav:node"/>
>
> </xsl:stylesheet>
>
>
> This is quite complicated, maybe I made some mistakes, or there
> is a simplier solution :)

Wow, amazing!  I ended up creating my own menu.xsl file that differs 
from the default one because I am using nested lists.  So, the nav 
underneath the selected section is displayed twice, and I'm not sure 
with the code I have in the design will work with the default file.  
Here's what I have:

<xsl:template match="nav:site">
     <div id="mainnav">
         <ul>
             <xsl:apply-templates select="nav:node[position( ) !=1]"/>
         </ul>
     </div>
</xsl:template>

<xsl:template match="nav:node">
     <xsl:call-template name="item"/>
     <xsl:apply-templates select="nav:node"/>
</xsl:template>

<xsl:template name="item">
     <xsl:choose>
         <xsl:when test="@current = 'true'">
             <xsl:call-template name="item-selected"/>
         </xsl:when>
         <xsl:otherwise>
             <xsl:call-template name="item-default"/>
         </xsl:otherwise>
     </xsl:choose>
</xsl:template>

<xsl:template name="item-selected">
     <xsl:choose>
         <xsl:when test="count(descendant-or-self::nav:node) > 1">
             <li class="selected"><a href="{@href}"><xsl:apply-templates
                 select="nav:label"/></a>
             <ul>
                 <xsl:call-template name="item-default"/>
                 <xsl:apply-templates select="nav:node"/>
             </ul></li>
         </xsl:when>
         <xsl:otherwise>
             <li><a href="{@href}"><xsl:apply-templates 
select="nav:label"/>
             </a></li>
         </xsl:otherwise>
     </xsl:choose>
</xsl:template>

<xsl:template name="item-default">
     <li><a href="{@href}"><xsl:apply-templates select="nav:label"/>
     </a></li>
</xsl:template>

Everything else is the same as the default, with the additions you 
specified above.  So, I'd like the result to look like this page: 
http://wwwn.hiram.edu/design/secondary.html (notice the menu below and 
the coding of the nested lists), but instead, I get this: 
http://wwwn.hiram.edu/design/secondary_lenya.html (notice how the 
secondary nav gets repeated underneath).  Notice also how it adds the 
High School Students link in there again?  I got rid of the Future 
Students link by using the position() function since it is taken care 
of by the tabs, but I can't seem to the same here.

> Maybe it makes sense to setup a "Navigation Framework FAQ" on the
> Wiki. Feel free to start it :)

I wholeheartedly agree.  If I get this going, I'd be happy to get 
something started and contribute to this great project.  :)

> HTH,
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: lenya-user-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Andreas Hartmann <an...@apache.org>.
Jonathan Linczak wrote:

[...]

> Yes, but it relies on CSS to say whether or not the menu item is 
> displayed or not, otherwise, I believe it lists the entire navigation in 
> the page.  I didn't think that was a great idea because since we have so 
> many documents in each of our publications, it would add to the file 
> size of the generated HTML page and would add to bandwidth usage, and 
> take generally more time for users on dial-up connections to see the 
> page for things that won't even be displayed.  I don't know, is that a 
> legitimate thing to worry about?  Is there really a way only to generate 
> the secondary nav for a selected section?

Ahhh, now I get your point :)

I misunderstood the sentence "I'd rather not display the whole menu and
just choose to display: none in CSS."

---

The navigation framework marks the currently selected node with
the current="true" attribute:

<nav:node current="true"/>

I guess what you have to do is create empty templates matching
all nodes which

- are not in the first level
- don't have a "current" ancestor
- don't have a father that has a "current" descendant

<xsl:stylesheet>

<xsl:import href="../../../../../xslt/navigation/menu.xsl"/>

<xsl:template match="nav:node/nav:node
           [not(ancestor-or-self::nav:node[@current = 'true']) and
            not(..//nav:node[@current = 'true'])]"/>

<xsl:template match="nav:node[@current = 'true']/*/nav:node"/>

</xsl:stylesheet>


This is quite complicated, maybe I made some mistakes, or there
is a simplier solution :)


Maybe it makes sense to setup a "Navigation Framework FAQ" on the
Wiki. Feel free to start it :)

HTH,
-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Jonathan Linczak <li...@hiram.edu>.
On Aug 6, 2004, at 11:12 AM, Andreas Hartmann wrote:

> Jonathan Linczak wrote:
>
>> On Aug 6, 2004, at 10:14 AM, Andreas Hartmann wrote:
>>> Jonathan Linczak wrote:
>>>
>>>> Hi all,
>>>> I'm having a big problem trying to figure out how to customize the 
>>>> menus in Lenya for the design I created.  Here's a quick 
>>>> explanation:
>>>> In parallel to using Lenya to add content, I worked with a designer 
>>>> to create a really great website design.  Unfortunately, I'm 
>>>> finding I can't seem to create the proper xsl files to create the 
>>>> menus shown in the design.  I have the front page showing just the 
>>>> top-level nav, but the secondary page has this kind of nav:
>>>> High School Students
>>>>    - Admission
>>>>    - Application
>>>>    - Majors and Minors
>>>>    - Something else
>>>> Transfer Students
>>>> International Students
>>>> Adult / Continuing Education
>>>> and so on and so forth.  So, when I click on the High School 
>>>> Students link on the home page, the menu above appears, showing 
>>>> only the next level of navigation for the chosen section only.
>>>
>>>
>>> I'm not sure if I get it right - is the menu above what you want
>>> (= your design) or what you have now (= default publication)?
>> Sorry, let's hope I can explain it better.  What's up there now is 
>> what I want to see on the page in my design.  My publication has 
>> many, many pages, but I just want to see the next level of 
>> information down from the High School Students section when it is 
>> selected.
>
> But that's the current behaviour of the default publication, isn't it?

Yes, but it relies on CSS to say whether or not the menu item is 
displayed or not, otherwise, I believe it lists the entire navigation 
in the page.  I didn't think that was a great idea because since we 
have so many documents in each of our publications, it would add to the 
file size of the generated HTML page and would add to bandwidth usage, 
and take generally more time for users on dial-up connections to see 
the page for things that won't even be displayed.  I don't know, is 
that a legitimate thing to worry about?  Is there really a way only to 
generate the secondary nav for a selected section?

Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Andreas Hartmann <an...@apache.org>.
Jonathan Linczak wrote:

> On Aug 6, 2004, at 10:14 AM, Andreas Hartmann wrote:
> 
>> Jonathan Linczak wrote:
>>
>>> Hi all,
>>> I'm having a big problem trying to figure out how to customize the 
>>> menus in Lenya for the design I created.  Here's a quick explanation:
>>> In parallel to using Lenya to add content, I worked with a designer 
>>> to create a really great website design.  Unfortunately, I'm finding 
>>> I can't seem to create the proper xsl files to create the menus shown 
>>> in the design.  I have the front page showing just the top-level nav, 
>>> but the secondary page has this kind of nav:
>>> High School Students
>>>    - Admission
>>>    - Application
>>>    - Majors and Minors
>>>    - Something else
>>> Transfer Students
>>> International Students
>>> Adult / Continuing Education
>>> and so on and so forth.  So, when I click on the High School Students 
>>> link on the home page, the menu above appears, showing only the next 
>>> level of navigation for the chosen section only.
>>
>>
>> I'm not sure if I get it right - is the menu above what you want
>> (= your design) or what you have now (= default publication)?
> 
> 
> Sorry, let's hope I can explain it better.  What's up there now is what 
> I want to see on the page in my design.  My publication has many, many 
> pages, but I just want to see the next level of information down from 
> the High School Students section when it is selected.

But that's the current behaviour of the default publication, isn't it?

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Jonathan Linczak <li...@hiram.edu>.
On Aug 6, 2004, at 10:14 AM, Andreas Hartmann wrote:

> Jonathan Linczak wrote:
>
>> Hi all,
>> I'm having a big problem trying to figure out how to customize the 
>> menus in Lenya for the design I created.  Here's a quick explanation:
>> In parallel to using Lenya to add content, I worked with a designer 
>> to create a really great website design.  Unfortunately, I'm finding 
>> I can't seem to create the proper xsl files to create the menus shown 
>> in the design.  I have the front page showing just the top-level nav, 
>> but the secondary page has this kind of nav:
>> High School Students
>>    - Admission
>>    - Application
>>    - Majors and Minors
>>    - Something else
>> Transfer Students
>> International Students
>> Adult / Continuing Education
>> and so on and so forth.  So, when I click on the High School Students 
>> link on the home page, the menu above appears, showing only the next 
>> level of navigation for the chosen section only.
>
> I'm not sure if I get it right - is the menu above what you want
> (= your design) or what you have now (= default publication)?

Sorry, let's hope I can explain it better.  What's up there now is what 
I want to see on the page in my design.  My publication has many, many 
pages, but I just want to see the next level of information down from 
the High School Students section when it is selected.  What happens 
after that is another question... :)

Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Problems with customizing navigatio

Posted by Andreas Hartmann <an...@apache.org>.
Jonathan Linczak wrote:

> Hi all,
> 
> I'm having a big problem trying to figure out how to customize the menus 
> in Lenya for the design I created.  Here's a quick explanation:
> 
> In parallel to using Lenya to add content, I worked with a designer to 
> create a really great website design.  Unfortunately, I'm finding I 
> can't seem to create the proper xsl files to create the menus shown in 
> the design.  I have the front page showing just the top-level nav, but 
> the secondary page has this kind of nav:
> 
> High School Students
>    - Admission
>    - Application
>    - Majors and Minors
>    - Something else
> Transfer Students
> International Students
> Adult / Continuing Education
> 
> and so on and so forth.  So, when I click on the High School Students 
> link on the home page, the menu above appears, showing only the next 
> level of navigation for the chosen section only.

I'm not sure if I get it right - is the menu above what you want
(= your design) or what you have now (= default publication)?

Could you add something like:

I have:

...

I want:

...

But don't worry, all these kinds of problems can be solved
with XSLT in quite straight-forward way.

-- Andreas

> I am doing this all 
> with nested lists, and since we have so much information, I'd rather not 
> display the whole menu and just choose to display: none in CSS.  Is 
> there any way to do this easily?  I'm not very familiar with Lenya as I 
> would like, and XSLT is not a strong suit of mine either.  Any help 
> would be *greatly* appreciated.
> 
> Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org