Still has all those nasty 'regular experssions' (I love the term regular
expressions .. not sure what is so regular about them <G>)
DSig
David Tod Sigafoos | SANMAR Corporation
PICK Guy
206-770-5585
davesigafoos(a)sanmar.com
-----Original Message-----
From: mediawiki-l-bounces(a)lists.wikimedia.org
[mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Jim Hu
Sent: Tuesday, August 07, 2007 6:29
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] User page formatting
Try this!
<?php
/*
* UserPageOnDemand.php - An extension 'module' for the
PagesOnDemand extension.
* @author Jim Hu (jimhu(a)tamu.edu)
* @version 0.1
* @copyright Copyright (C) 2007 Jim Hu
* @license The MIT License -
http://www.opensource.org/licenses/mit-
license.php
*/
if ( ! defined( 'MEDIAWIKI' ) ) die();
# Credits
$wgExtensionCredits['other'][] = array(
'name'=>'UserPageOnDemand',
'author'=>'Jim Hu &lt;jimhu(a)tamu.edu&gt;'u.edu>',
'description'=>'Demo for PagesOnDemand mechanism for generating
User pages from template on demand.',
'version'=>'0.1'
);
# Register hooks ('PagesOnDemand' hook is provided by the
PagesOnDemand extension).
$wgHooks['PagesOnDemand'][] = 'wfLoadUserPageOnDemand';
/**
* Loads a demo page if the title matches a particular pattern.
* @param Title title The Title to check or create.
*/
function wfLoadUserPageOnDemand( $title, $article ){
# Short-circuit if $title isn't in the MAIN namespace or doesn't
match the DEMO pattern.
if ( $title->getNamespace() != NS_USER) {
return true;
}
$template = Revision::newFromTitle(Title::makeTitle(NS_TEMPLATE,
'User_page_template'));
if (! $template){
$text = "Can't find template page Template:User_page_template";
}else{
$text = $template->getText();
#strip out noinclude sections
$text = preg_replace( '/<noinclude>.*?<\/noinclude>/s',
'',
$text );
} # Create the User page's new text - could be more
complicated, but
this is just a demo
# Create the Article, supplying the new text
$article = new Article($title);
$article->doEdit( $text, 'Create user page from template via
PagesOnDemand', EDIT_NEW | EDIT_FORCE_BOT );
# All done (returning false to kill PoD's wfRunHooks stack)
return false;
}
?>
On Aug 7, 2007, at 6:31 AM, Nancy Dailey wrote:
Thank you. BoilerplateSelection would work but since
it takes the
user to an edit page so early in the use of the wiki, it overwhelms
them. My experience using wikis inside business organizations is
that form is far more important than function to get them to early
adopt use of wikis as a productivity/team building tool. I will try
to modify PagesOnDemand. Thank you so much for your help! Nancy
<snip>
=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l