Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

IncludeFieldPage

Summary: Extends the (:include:) directive functionality apply to pages from other fields of a wiki farm
Version: 1.0.0 - 22 November 2005
Prerequisites: requires at least PmWiki version: 2.0.0; last tested on PmWiki version: 2.0.13
Status:
Maintainer: Henrik Bechmann
Categories: Includes, WikiFarms

Description

Extends the (:include:) directive functionality apply to pages from other fields of a wiki farm.

This recipe creates a directive (:includefieldpage:) which mimics and extends the functionality of the (:include:) directive to allow you to include pages from other fields of a wiki farm. It requires a field=FieldName parameter, and allows the lines= and #start#end selection parameters used by (:include:).

Caution: This directive bypasses all authorizations (ie. read authorization) for the included pages.

Download includefieldpage.phpΔ to your cookbook directory.

Notes

To use this directive:

  • install includefieldpage.phpΔ to your cookbook directory
  • add farm-wide intermap entries for each field to be referenced by the field=FieldName parameter
  • follow intra-site link conventions (for images and website pages) which allow links to function in the context of pages in which the links are included with (:includefieldpage:)

Add farm-wide intermap entries for each field

Suppose that you have two fields in your wiki farm which you name

Holidays
Parties

You follow the convention of having a directory for each field, with a wiki subdirectory. You want to include pages from each field in the other.

Then in your farmmap.txt file, add the following entries:

HolidaysField:           /myholidays/wiki/wiki.d/
PartiesField:            /myparties/wiki/wiki.d/

Note the appending of the suffix Field to each wiki field name.

To use the directive, if you have a PrivateParties group with a MyFirstParty page in the Parties field, and want to include that page in a Holidays page, you can write:

(:includefieldpage field=Parties PrivateParties.MyFirstParty :)

in a Holidays page.

You can also write

(:includefieldpage field=Parties PrivateParties.MyFirstParty lines =1..10 :)

or

(:includefieldpage field=Parties PrivateParties.MyFirstParty#start#end :)

to include partial pages by souce code line count, or name links placed in the source page.

Follow intra-site link conventions

Relative addressing (for wikipages and images) in the context of one field will not work in another, so pages that will be included in other fields must follow link writing conventions which will resolve to correct addresses in any field context. The intermap facility can be used for this.

For page links, you can set up intermap links in farmmap.txt like this:

HolidaysWiki:           /myholidays/wiki/wiki.d/wiki.php/
PartiesWiki:            /myparties/wiki/widi.d/wiki.php/

and then rather than writing a link as MyGroup.MyPage, write it as:

[[HolidaysWiki:MyGroup.MyPage | Link to my special holiday]]

This form will resolve in either field, should the page be included in the other field.

For images, if you use the Attach: convention, and have selected an attach directory named "uploads", then add the following to your farmmap.txt file:

HolidaysAttach:           /myholidays/wiki/uploads/
PartiesAttach:            /myparties/wiki/uploads/

The Attach mechanism places uploaded files in subdirectories named by group, so you would then write

HolidaysAttach:MyGroup/MyPicture.jpg

instead of

Attach:MyPicture.jpg

to make the link work in any field context.

Releases

Version 1.0.0 November 22, 2005. Basic Release

See Also

Contributors

Henrik Bechmann (Henrik@BechmannSoftware.com)

Comments

See discussion at IncludeFieldPage-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 21, 2013, at 08:16 PM