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
#start#end selection parameters used by (:include:).
Caution: This directive bypasses all authorizations (ie. read authorization) for the included pages.
To use this directive:
- install includefieldpage.phpΔ to your cookbook directory
- add farm-wide intermap entries for each field to be referenced by the
- 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
Add farm-wide intermap entries for each field
Suppose that you have two fields in your wiki farm which you name
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 :)
(: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
to make the link work in any field context.
Version 1.0.0 November 22, 2005. Basic Release
Henrik Bechmann (Henrik@BechmannSoftware.com)