Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

IncludeWithEdit

Summary: Enable editing of included text
Version: 2005-02-07
Prerequisites:
Status: last tested on PmWiki Version 2.2.0.beta45
Maintainer: KAL
Categories: Editing, Includes

Question

How to place a edit-link before or at the end of included text so that an author can directly edit the included text ?

Will look like that:

some text on a wikipage
..................................................................
                                                           [edit]

included text on the wiki-page
..................................................................

To edit the text of the included text the edit-link on the right can be used (e.g. in Mozilla by clicking with the middle-mouse-button to open the included page in a new tab for editing.)

To include a page with edit-link use the new directive (:included PAGENAME:) (or any other markup-name you prefer, just change the code below)

The separation of the included text and the style of the edit-link can be changed by using css.

Solution:

A new markup and css-styles can be defined to display the edit-link.

Add the following code to your config.php or farmconfig.php

  • to get a button as a edit-link before the included text:
  Markup('included','>if',"/\\(:included\\s+(.+?):\\)/e",
         "PRR().'<p class=\\\'included\\\'><span class=\\\'button\\\'>".
         "[[$1?action=edit|[-EDIT-]]]</span></p>'".
         ".IncludeText(\$pagename,'include $1').".
         "'<br/><p class=\\\'included\\\'/>'");
  • to get a button as a edit-link at the end the included text:
  Markup('included','>if',"/\\(:included\\s+(.+?):\\)/e",
         "PRR().'<p class=\\\'included\\\'>".
         "[[$1?action=edit|[-EDIT-]]]</span></p>'".
         ".IncludeText(\$pagename,'include $1').".
         "'<br/><span class=\\\'button\\\'><p class=\\\'included\\\'/>'");

add some css-definitions for the classes ".included" and ".button" to your skin-css (for display and print). Here's a sample css-definition:

screen.css: display a dotted line and an edit-"button" before and a dotted line after the included text

.included { 
  color:gray; 
  border-top:dashed 1px; 
  text-align:right;
}
.button {
  font-family:Arial;
  font-size:80%; 
  font-weight:bold;
  font-style:normal;
  color:#008000;
  white-space:nowrap;

  border:outset 2px #C0C0C0;
  background:#CCFFCC;

  padding-left:5px;
  padding-right:5px;
}

.button a {
  color:#008000;
  text-decoration:none;
}

print.css: don't print this additional stuff

.buttons, .included { 
  display:none;
}

See also:

Contributor

  • KAL 2004-11-27 - first implementation
  • KAL 2005-02-07 - fixed sample implementation link

Comments

See discussion at IncludeWithEdit-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. 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 22, 2013, at 02:37 AM