Add Page Numbers
THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO
In this tutorial, you will learn how to add page numbers to your web publication.
You may want to include the page number and the total number of pages in your web publication. Page numbers, along with the breadcrumb are two useful indicator of where a reader is in a publication.
Add the page elements to the template
To add the page elements to the template, follow these steps:
- Select the Collection tab;
- Click on the small button beside the templates drop down list;
- Select the publication template to open it for editing;
- Once in the temple, locate the place where you want to add the page numbers;
- Copy and paste the makup below.
<!-- page / pages --> <xsl:if test="$page_num"> <div class="pagenums"> <xsl:value-of select="$page_num"/> / <xsl:value-of select="$page_total"/> </div> </xsl:if>
The above markup first checks if the page number parameter was sent to the template, it then creates a div element in which are inserted the two parameters.
To insert the page numbers near the Back link at the bottom of the page, look for the following makup:
<!-- back bottom --> <div class="back"> <a href="javascript:history.go(-1);">Back</a> </div>
After you seved the template, you can publish your collection to see the result. Altough it might not look like you expected.
Add the pagenums selector to the stylesheet
It's now time to add a bit of style to the pagenums element.
To add the appropriate style, follow these steps:
- Select the Content or Topic tab;
- Click on the small button beside the stylesheets drop down list;
- From the popup menu, select the publication main stylesheet;
- Once in the stylesheet. find the div.back selector;
- Copy and paste the selector below just above the dv.back selector.
div.pagenums {float:right; margin-right:8px; font-size:0.82em; clear:both;}
In the above selector, the page numbers are floated to the right (float:right;). The selector also makes sure the page numbers stacks well with the back link by using clear:both;.
Once your style selector is added and your stylesheet saved, you can refresh your browser to see the final result.
THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO