EditMore
Questions answered by this recipe
- How can I add an input field for Title, Description, Keywords, Tags, and Notes?
- How can I make it manditory to fill in a Summary, Title, Description, Keywords, Tags, or Notes?
- How can I make the Title, by default, equal to {$Namespaced}?
- How can I make my list of categories (Tags) visible or hidden?
- How can I maintain pagelist templates, WikiStyles, and development notes separate from the page's text and have them automatically hidden from people reading the page (Notes)?
Description
There are some changes to this version, so if you are already using the recipe, read carefully.
EditForm Fields
This script adds new input fields that you can add to Site.EditForm if you like:
- (:input e_title :) - for a page title.
- (:input e_description :) - for a metatag description.
- (:input e_keywords :) - for metatag keywords.
- (:input e_tags :) - for a list of categories or links to relevant pages.
- (:input e_notes :) - for development notes, pagelist templates, wikistyles, or page directives (ala (:nogroupheader:).
You can turn some of these off by removing them from this variable:
$EMFields = array('title','description','keywords','tags','notes');
Mandatory Fields
To make certain fields mandatory, use this variable:
$EMForcefully = array('title','summary','description','keywords','notes','tags');
This code would make all of them mandatory!!!
Other Options
To make the Title default to {$Namespaced},
$EMTitleFillEmpty = 1;
This is the default. Set to = 0 to turn it off.
To make the Notes field display on the page, set this variable equal to the CSS ID you would like to use to format it...
$EMNotesDisplay = 'EMNotesID';
By default, it remains hidden. Set $EMNotesDisplay = 0; to achieve the same effect.
To mkae Notes go to the top of the page instead of the bottom,
$EMNotesPosition = 'top';
Otherwise, it will stay at the bottom.
Instructions
- upload editmore.phpΔ to your /cookbook/ folder.
- add include_once("
$FarmD
/cookbook/editmore.php"); to your /local/config.php. - add Title: (:input e_title:)\\Keywords: (:input e_keywords:)\\Description: (:input e_description:)\\Tags: (:input e_tags:)\\Notes:\\(:input e_notes:)\\ to somewhere in your Site.EditForm
- to display tags, reference {$:tags} somewhere on the page. It's done this way so that you can add it to your Group.GroupFooter using {{*$FullName}$:tags}
Notes
Filling In Tags
When filling in the Tags box, all categories or links should be separated by a comma (,). However, all of the following inputs are accepted:
Will become a link to your {$CategoryGroup}
- The word Category: [[category:This|that]], [[Category.This]], [[category/This]], Category:This, category.This, Category/This
- Your actual Categories Group: [[{$CategoryGroup}:This|that]], [[{$CategoryGroup}.This]], [[{$CategoryGroup}/This]], {$CategoryGroup}:This, {$categorygroup}.This, {$CategoryGroup}/This
- !: [[!This|that]], !This
- Just a word: This, this
Will become a regular link
- ANY PAGE ON YOUR SITE: [[Group/This]], [[group.This]], Group/This, Group.This
- Path: [Wikipedia:This, [[Path:../this/is/the/place|germs]] * ''URLs:'' [=[[http://www.example.com/this|that]], http://mike.upisup.com
- Attach (be careful when linking to other pages uploads): Attach:editmore.php
As I'm sure you've gathered, it's case insensitive in any case that PmWiki would be.
These variables are enabled so that you can customize the look of the <input fields, either by specific attributes (size=, rows=, etc.) or by assigning classes (class=''):
* $EMTitleInputDisplay
- $EMKeywordsInputDisplay
- $EMDescriptionInputDisplay
- $EMTagsInputDisplay
- $EMNotesInputDisplay
These variables are so that you can customize the message for when a user does not fill in a required field:
* $EMForceTitleFmt
- $EMForceKeywordsFmt
- $EMForceDescriptionFmt
- $EMForceTagsFmt
- $EMForceNotesFmt
- $EMForceSummaryFmt
Release Notes
- 2007-09-18
- Added Notes box, added //easy// linking in **Tags** box, option to have **Title** default to {$Namespaced} when empty, and completely revised code to be "tighter".
- 2007-08-31
- Revised release! Now you can add hidden categories to your page, which are added to the <div> made with MediaCategories.
- 2007-08-30
- First Release, comments desired and welcomed.
See Also
- EditAttributes Edit a page's title, description and other attributes using separate EditForm fields
- Edit Title
- Require Author
- Require Summary
- Page variables
Contributors
Comments
See discussion at EditMore-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.