Campsite 2.3 User Guide

Campsite 2.3 User Guide

Select your language:  
    Search:   
<5.1. Template Quickstart Guide: "How do I..."        5.1.2. How to display the most recently published articles?>

Print / Download:
Available languages: english Last update: 2005-10-12 07:55:09

5.1.1. How to do article pagination?

This example will show you how to split an article on multiple pages. We assume the article type is fastnews and has three fields: date (date field type), intro (body field type) and body (body field type). You'll find this example implemented in the Campsite demo package here.

Here is the code:

1. <!** With fastnews body>
2. <!** List Subtitle>
3. <!** If List Start>
4. Subheads:
5. <!** EndIf>
6. <!** If CurrentSubtitle>
7. <p><!** Print List Index>. <!** Print Subtitle Name></p>
8. <!** Else>
9. <p><a href="<!** URI>"><!** Print List Index>. <!** Print Subtitle Name></a></p>
10. <!** EndIf>
11. <!** If List End>
12. <a href="<!** URI AllSubtitles>">single page view</a>
13. <!** EndIf>
14. <!** EndList>
15. <p><!** Print Article body></p>
16. <br clear=all><hr
17. <table width="100%"><tr>
18. <!** If PrevSubtitles>
19. <td align=right><a href="<!** URI>">Previous subhead</a></td>
20. <!** Else>
21. <td align=right><font color=#B7B7B7>No previous subhead</font></td>
22. <!** EndIf>
23. <td width="1%">|</td>
24. <!** If NextSubtitles>
25. <td align=left><a href="<!** URI>">Next subhead</a></td>
26. <!** Else>
27. <td align=left><font color=#B7B7B7>No next subhead</font></td>
28. <!** EndIf>
29. </tr></table>
30.<!** EndWith>
Lines 2-14 display the list of article subtitles (List Subtitle):
  • display the text "Subheads:" if at the beginning of the list (If List Start)
  • display the subtitle name as simple text for the current subtitle - the one that's being viewed - (If CurrentSubtitle)
  • display the subtitle name as link for other subtitles (If CurrentSubtitle - else branch)
  • at the end of the list display "single page view" link (URI AllSubtitles) - this will display the whole article (all subtitles) in one page
Line 15 display the actual article content, in this case the current subtitle (Print Article body).

Lines 17-29 create links to navigate to the previous or next subtitle (If PrevSubtitles, If NextSubtitles).

The example given above will make your page look something like this:


Note: CSS styles have been removed from the example to make it easier to read, so if you use the code above it will not look exactly as shown; the colors will not be there, and the spacing will be a bit different.


add a note add a note User Contributed Notes
5.1.1. How to do article pagination?
There are no user contributed notes for this page.

<5.1. Template Quickstart Guide: "How do I..." 5.1.2. How to display the most recently published articles?>

  Last update: 2005-10-12 07:55:09
Website powered by Docmint Last update: 2005-10-12 07:55:09
Total page time: 0.676553964615