You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Dmitri Pissarenko <ma...@dapissarenko.com> on 2004/10/08 13:37:30 UTC
Navigation links
Hello!
I have about 50 text files, which are chapters of a larger text.
I want to create a website, on which each of these texts is shown in a
separate HTML file
and in each of these files there are navigation buttons (links to next
and previous
chapter).
I want to create those navigation links automatically.
Is there an (easy) way to do it in Apache Forrest?
Thanks in advance
dap
--
Dmitri Pissarenko
Software Engineer
http://dapissarenko.com
Re: Navigation links
Posted by Dmitri Pissarenko <ma...@dapissarenko.com>.
Thanks!
Re: Navigation links
Posted by Ross Gardler <rg...@apache.org>.
Johannes Schaefer wrote:
> Dmitri Pissarenko wrote:
>
>> Hello!
>>
>> I have about 50 text files, which are chapters of a larger text.
>>
>> I want to create a website, on which each of these texts is shown in a
>> separate HTML file
>>
>> and in each of these files there are navigation buttons (links to next
>> and previous
>>
>> chapter).
>>
>> I want to create those navigation links automatically.
>>
>> Is there an (easy) way to do it in Apache Forrest?
>>
>> Thanks in advance
>>
>> dap
>
>
> I would be very interested in "back|next", too.
> We have a solution for a link "back to top", if you're
> interested ...
Forrest cannot currently do this by default so I've copied this to the
dev list since there is a partial solution below:
I have a skin that does this (actually I broke the "back" section, but
next works, back used to work, I just haven't had time to fix it).
This is another of a long line of things that I have been trying to find
the time to tidy up and commit to Forrest. If you know XSL then you
could have a go at making my partial solution work properly and I'll put
it into Forrest (with a property to make it optional of course).
Here is the relevant XSL code from site2xhtml.xsl:
<!-- creates links to the next and previous files as dictated by the
menu -->
<xsl:template name="navigationLinks">
<xsl:if test="not($config/navigation/next/@enabled = 'false')">
<span class="navigation">
<xsl:for-each select="//div[@class='menu']//span[@class='sel']">
<!-- Preceding Link -->
<!-- FIXME: this is broken
<xsl:variable name="dirname">
<xsl:call-template name="dirname">
<xsl:with-param name="path" select="ancestor::a[4]/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="filename">
<xsl:with-param name="path" select="./a/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="linkText">
<xsl:value-of select="../preceding-sibling::*"/>
</xsl:variable>
<a class="dida">
<xsl:attribute name="href">../<xsl:value-of
select="$dirname"/>/<xsl:value-of select="$filename"/></xsl:attribute>
<img class="skin" src="{$skin-img-dir}/previous.gif"
alt="Previous:"/>
<xsl:value-of select="$linkText"/>
</a>
<img class="spacer" src="{$spacer}" alt="" width="10"
height="8" />-->
<!-- Following Link -->
<xsl:choose>
<xsl:when test="../following-sibling::*">
<xsl:variable name="linkText">
<xsl:value-of select="../following-sibling::*"/>
</xsl:variable>
<xsl:variable name="dirname">
<xsl:call-template name="dirname">
<xsl:with-param name="path"
select="../following-sibling::*/a/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="filename">
<xsl:with-param name="path"
select="../following-sibling::*/a/@href"/>
</xsl:call-template>
</xsl:variable>
<a class="dida">
<xsl:attribute name="href"><xsl:value-of
select="$dirname"/><xsl:value-of select="$filename"/></xsl:attribute>
<img class="skin" src="{$skin-img-dir}/next.gif"
alt="Next:"/>
<xsl:value-of select="$linkText"/>
</a>
<img class="spacer" src="{$spacer}" alt="" width="20"
height="8" />
</xsl:when>
<xsl:otherwise>
(Last in Section - choose a new section from the menu)
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
</xsl:template>
Just call this template to generate the link(s) in the relevant location
on your document.
Ross
Re: Navigation links
Posted by Ross Gardler <rg...@apache.org>.
Johannes Schaefer wrote:
> Dmitri Pissarenko wrote:
>
>> Hello!
>>
>> I have about 50 text files, which are chapters of a larger text.
>>
>> I want to create a website, on which each of these texts is shown in a
>> separate HTML file
>>
>> and in each of these files there are navigation buttons (links to next
>> and previous
>>
>> chapter).
>>
>> I want to create those navigation links automatically.
>>
>> Is there an (easy) way to do it in Apache Forrest?
>>
>> Thanks in advance
>>
>> dap
>
>
> I would be very interested in "back|next", too.
> We have a solution for a link "back to top", if you're
> interested ...
Forrest cannot currently do this by default so I've copied this to the
dev list since there is a partial solution below:
I have a skin that does this (actually I broke the "back" section, but
next works, back used to work, I just haven't had time to fix it).
This is another of a long line of things that I have been trying to find
the time to tidy up and commit to Forrest. If you know XSL then you
could have a go at making my partial solution work properly and I'll put
it into Forrest (with a property to make it optional of course).
Here is the relevant XSL code from site2xhtml.xsl:
<!-- creates links to the next and previous files as dictated by the
menu -->
<xsl:template name="navigationLinks">
<xsl:if test="not($config/navigation/next/@enabled = 'false')">
<span class="navigation">
<xsl:for-each select="//div[@class='menu']//span[@class='sel']">
<!-- Preceding Link -->
<!-- FIXME: this is broken
<xsl:variable name="dirname">
<xsl:call-template name="dirname">
<xsl:with-param name="path" select="ancestor::a[4]/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="filename">
<xsl:with-param name="path" select="./a/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="linkText">
<xsl:value-of select="../preceding-sibling::*"/>
</xsl:variable>
<a class="dida">
<xsl:attribute name="href">../<xsl:value-of
select="$dirname"/>/<xsl:value-of select="$filename"/></xsl:attribute>
<img class="skin" src="{$skin-img-dir}/previous.gif"
alt="Previous:"/>
<xsl:value-of select="$linkText"/>
</a>
<img class="spacer" src="{$spacer}" alt="" width="10"
height="8" />-->
<!-- Following Link -->
<xsl:choose>
<xsl:when test="../following-sibling::*">
<xsl:variable name="linkText">
<xsl:value-of select="../following-sibling::*"/>
</xsl:variable>
<xsl:variable name="dirname">
<xsl:call-template name="dirname">
<xsl:with-param name="path"
select="../following-sibling::*/a/@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="filename">
<xsl:with-param name="path"
select="../following-sibling::*/a/@href"/>
</xsl:call-template>
</xsl:variable>
<a class="dida">
<xsl:attribute name="href"><xsl:value-of
select="$dirname"/><xsl:value-of select="$filename"/></xsl:attribute>
<img class="skin" src="{$skin-img-dir}/next.gif"
alt="Next:"/>
<xsl:value-of select="$linkText"/>
</a>
<img class="spacer" src="{$spacer}" alt="" width="20"
height="8" />
</xsl:when>
<xsl:otherwise>
(Last in Section - choose a new section from the menu)
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
</xsl:template>
Just call this template to generate the link(s) in the relevant location
on your document.
Ross
Re: Navigation links
Posted by Ross Gardler <rg...@apache.org>.
Nicola Ken Barozzi wrote:
> Ross Gardler wrote:
>
>> Johannes Schaefer wrote:
>>
>>> I would be very interested in "back|next", too.
>>> We have a solution for a link "back to top", if you're
>>> interested ...
>>
>>
>> Forrest cannot currently do this by default so I've copied this to the
>> dev list since there is a partial solution below:
>>
>> I have a skin that does this (actually I broke the "back" section, but
>> next works, back used to work, I just haven't had time to fix it).
>>
>> This is another of a long line of things that I have been trying to
>> find the time to tidy up and commit to Forrest. If you know XSL then
>> you could have a go at making my partial solution work properly and
>> I'll put it into Forrest (with a property to make it optional of course).
>
>
> A note: HTML has <link> in the <head> that can be used in the future to
> make navigation links customized per page.
>
I *knew* I needed to post this here too. Glad I did now. I will be sure
to use:
<link rel="next" href="nextPage.html" />
<link rel="prev" href="prevPage.html" />
The skin then then choose to render this or not thus removing the need
for a global property.
Thanks for the reminder, I'll put this in the issue tracker so I don;t
forget.
Ross
Re: Navigation links
Posted by Nicola Ken Barozzi <ni...@apache.org>.
Ross Gardler wrote:
> Johannes Schaefer wrote:
>
>> I would be very interested in "back|next", too.
>> We have a solution for a link "back to top", if you're
>> interested ...
>
> Forrest cannot currently do this by default so I've copied this to the
> dev list since there is a partial solution below:
>
> I have a skin that does this (actually I broke the "back" section, but
> next works, back used to work, I just haven't had time to fix it).
>
> This is another of a long line of things that I have been trying to find
> the time to tidy up and commit to Forrest. If you know XSL then you
> could have a go at making my partial solution work properly and I'll put
> it into Forrest (with a property to make it optional of course).
A note: HTML has <link> in the <head> that can be used in the future to
make navigation links customized per page.
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: Navigation links
Posted by Johannes Schaefer <jo...@uidesign.de>.
Dmitri Pissarenko wrote:
> Hello!
>
> I have about 50 text files, which are chapters of a larger text.
>
> I want to create a website, on which each of these texts is shown in a
> separate HTML file
>
> and in each of these files there are navigation buttons (links to next
> and previous
>
> chapter).
>
> I want to create those navigation links automatically.
>
> Is there an (easy) way to do it in Apache Forrest?
>
> Thanks in advance
>
> dap
I would be very interested in "back|next", too.
We have a solution for a link "back to top", if you're
interested ...
js
--
User Interface Design GmbH * Teinacher Str. 38 * D-71634 Ludwigsburg
Fon +49 (0)7141 377 000 * Fax +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH * Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de
Buch "User Interface Tuning" von Joachim Machate & Michael Burmester
www.user-interface-tuning.de
Attraktivität von interaktiven Produkten messen mit
www.attrakdiff.de