Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

BreakPage

Summary: Breaks pages into sections with inserted markers and displays one section at a time
Status: Stable
Version: 2004-10-20(breakpage.php, 2006-10-28(breakpage2.php), 2005-08-18(break_page.php)
Prerequisites: pmwiki-2.1
Maintainer: jr
Categories: CMS
Download: breakpage.phpΔ
break_page.phpΔ (with editable sections)

Questions answered by this recipe

How can I break long pages into smaller page chunks which can be sequentially displayed as 1, 2, 3, ...

Description

By installing breakpage.phpΔ you can add section break markers (:breakpage:) onto a page, which the recipe will use to break the page into sections and display one at a time, with links to the others. It does not add edit links to edit each section separately, as break_page.phpΔ does.

  • breakpage.phpΔ -- the original recipe script. It uses (:breakpage:) directive as markers. Works with pmwiki 2.1.
  • breakpage2.phpΔ -- Modified for use with CommentBoxPlus using markers (:comment breakpage:) to result in invisible markers even if page breaks are disabled.
  • break_page.phpΔ -- Alternative -- adds the following features:
    • work with beta 44 and above (further testing still required -- this is a major change)
    • change the (:breakpage:) directive to ____ (4 underscores)
    • add action=editpage which lets you edit the current chunk via a link at the top of the page
    • add a tool tip to the page numbers to show the first paragraph of the page

Release Notes break_page.phpΔ

  • 2005-08-01: fix break_page to work with new edit page features.
  • 2004-11-29: minor bug fix 29 Nov 2004 to add newlines around the chunk being posted
  • 2004-11-07: original release of break_page.phpΔ jr

Current status (jr 18 Aug 2004):

  • break_page (the 4 underscores version) works with beta 53; PmWiki introduced an $EnablePost variable and set it to true, thereby causing a break_page edit request to post the chunk being edited, throwing away the rest of the page (ouch!)
  • it uses a $PageEditFmt variable, rather than the edit form; the variable includes a summary text box, but not a Save and Edit button; fixing the problem described above seemed more important
  • the plan is first to add a Save and Edit button to the $PageEditFmt variable, then investigate how to use a form variable to hold the editing components, then possibly merge all the different versions into one configurable recipe

Alternative: break-page.phpΔ

This script uses section break markers of form ==== to create editable page sections, but does not display only one section at a time. In addition optionally headers can be used to form automatic editable sections on the page.

Important: Klonk has forked SectionEdit from this script. It is recommended that you switch from break-page to SectionEdit. Though you will get support for break-page all current development resources are going into SectionEdit.

Should this go in the Superseded section? - Martin Fick

Changes from the break_page.php script:

  • seperates the page in several editable sections but displays all page content on one page
  • changes the ____ directive to ====
  • works with 2beta54 and supports Site.EditForm. You have to change in scripts/forms.php line
    if ($action != 'edit') return; 

into

    if ($action != 'edit' && $action != 'editpage') return; 

Version 1.4+ has an auto section function: every header should get an edit section link, if you put

    $BreakPageAuto = true;

in your config.php before the include line. To avoid auto sections for a side (i.e. SideBar) put

 (:nosections:)

on it. If you use auto sections the ==== does only go until the next header element. If an introducing ==== is missing in the header section it is set for the user automaticly.

Schlaefer August 31, 2005, at 01:50 AM

Discussion

Sometimes authors would like to be able to break large PmWiki pages into smaller chunks to improve readability. This recipe adds a (:breakpage:) markup to allow an author to specify where to split the page. (:breakpage:) also provides a "Page 1 2 3 ..." set of links at the bottom of each page to allow navigation to other chunks of the page. The bottom of this page demonstrates the use of (:breakpage:) directive.

Just a thought: maybe "____" (4 underscores by analogy with ----) is worth considering, instead of using a directive. jr
This sounds pretty good to me, perhaps "in addition to" a directive?

This recipe only enables (:breakpage:) when browsing pages; other actions (e.g., ?action=print simply ignore (:breakpage:) directives.

To enable this recipe, simply place the breakpage.phpΔ script in your cookbook/ directory, then add the following line to your config.php:

    include('cookbook/breakpage.php')
Usage note
If your page also includes (:nogroupheader:) or (:nogroupfooter:) directives, you will need to mention them in each page section. This is because PmWiki processes these after it has processed any (:breakpage:) directives.
We could always process (:breakpage:) after the (:nogroup(header|footer):) directives. What do you think? --Pm
Not sure, both have pros and contras... --[~Balu]
My thinking was that group headers and footers are not part of the page content and so should always be displayed. Otherwise (assuming headers and footers are normally displayed), page 1 has a header and no footer, page 2 has neither and page 3 has a footer and no header. This seems somehow wrong to me; at the least, it's confusing.
Alternatively, the nogroupheader/footer processing could work on the original page text, rather than the page cutting.--jr

19-Feb-2005 what about i18n? is BreakPage able to use XLPage translating words for "Page" and "edit"? Please adjust it. I don't know how. (i can change it in the source but thats not Wiki-like.) newmy

23.3.206 (:toc:) directive in the beginig of the document shows the headings only of the 1st page, not of the whole document. How to fix it? Jiri


March 27, 2005 - Can we have this behaviour added automatically, say, for each first header (h1) and h2? How do you suggest this could be done? A markup change? Thanks --m

Contributors

  • Pm, Sep-06-2004
  • jr, Sep-06-2004 enhancements 8 Nov

Sandbox

User notes?: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date

These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 11, 2007, at 05:03 AM