|
Cookbook /
JjsCMSadministrators Summary: Save wiki pages as html
Version: 1.4beta3
Prerequisites:
Status:
Maintainer: jjs
Categories: CMS
QuestionHow can I use PmWiki as a CMS
Or
AnswerUse jjscms. It saves a modified copy of every page into a specified directory.
Since version 1.4beta1 this is done for How it worksjjscms.php uses php's output buffering feature to capture complete pmwiki pages. An in-memory copy of the captured page is filtered with some regexps and saved to a file. Then the original captured page is presented to the user. The static pages can be served by a webserver without php, or served by a custom script that could even do further "magic". UsageCopy jjscms1_4beta3.phpΔ into your cookbook dir. Add to local/config.php: require_once($FarmD . '/cookbook/jjscms1_4beta3.php'); add to Site.PageActions:
* %item rel=nofollow class=edit%[[{$FullName}?action=jjscmspublish | $[Publish] ]]
Since 1.4beta3 no further configuration should be needed to get it working. Advanced configurationBy default jjscms will save all published pages in the published subdir of your wiki.
The $PubDir and Depending on how you plan to separate the cms from its output and restrict pmwiki usage via htaccess, you may have to alter the directory structure of the wiki and set the $JJSCMS.., You could also secure the wiki dir by .htaccess and write a script to serve all files from there (Attachments and Skin files). Configuration Variables
Password ProtectionAction jjscmspublish can be password protected. Look at the GroupAttributes page. In 1.4beta1 the default password is empty! Defining what pages may be publishedIf JJSApprovePage is installed, jjscms will only publish a page if it is in approved state. Skin / Template changesYou probably have to alter your skins .tmpl file so that the stylesheet-url works from pmwiki as well as in the static version. To completely remove the edit bar from the static version, add the comment pairs from above around the edit bar section in your skins .tmpl file. Using a different Skin for publishingTo use the "print" skin for publishing add $ActionSkin['jjscmspublish'] = 'print'; to your ScriptHere's a sample script for serving the static pages. You can name it index.php and put it in the main directory of your site. It assumes the static pages to reside in Attachments and skin files must be accessible from their original location. The $JJSCMSPublishUrl should read
<?php
if (isset($_REQUEST['showcmspage']))
{
$cmspage = preg_replace('/([[:alnum:]])\.html/s','$1.html',trim($_REQUEST['showcmspage']));
@readfile('published/' . $cmspage);
return;
}
else
{
@readfile('published/Main.HomePage.html');
return;
}
?>
2006-03-18 Jens Schiffler Notes and CommentsThe newest the latest. And please don't forget to end by date and name. Thanks) Sidebar and other included content not updatedWhen you've edited a page that is referenced inside the template or from any other wiki page, (eg. the Sidebar) then you must browse to all referencing pages in order to update their static copy. There's no magic "make" like functionality implemented. JJSIterator presents a workaround: Install jjsiterator and using an url like http://.../pmwiki?jjsiterator=0&action=jjscmspublish your browser will visit all pages in your wiki thereby refreshing the jjscms cache. Patch to skins.phpUsing a shared pub dir above the pmwiki dir requires a small patch to scripts/skins.php:
foreach((array)$skin as $s) {
$sd = FmtPageName("pub/skins/$s", $pagename);
if (is_dir($sd))
{ $Skin=$s; $SkinDirUrl="$PubDirUrl/skins/$Skin"; break; }
$sd = FmtPageName("$FarmD/pub/skins/$s", $pagename);
if (is_dir($sd))
{ $Skin=$s; $SkinDirUrl="$FarmPubDirUrl/skins/$Skin"; break; }
# BEGIN JJS 2005-04-04
global $PubDir;
$sd = FmtPageName("$PubDir/skins/$s", $pagename);
if (is_dir($sd))
{ $Skin=$s; $SkinDirUrl="$PubDirUrl/skins/$Skin"; break; }
# END JJS 2005-04-04
}
Cannot modify header informationI tried to use JjsCMS with PmWiki 2.1.beta17 and got this warning: require_once('pmwiki/cookbook/jjscms.php'); Warning: Cannot modify header information - headers already sent by (output started at public_html/pmwiki/local/config.php:2) in public_html/pmwiki/pmwiki.php on line 769
Nothing is output in the public static directory defined by $PublishDir. [Edit 2006-02-04] Oops, I didn't have <?php if (!defined('PmWiki')) exit(); in config.php. After fixing this, I still got no output though. JustAGuest, 2006-01-03
There is a bug in 1.0. Please try version 1.1. If it still doesn't work please use the mailing list or contact me. Jens, 2006-01-20
Any explicit explanation for this recipe?Tried to use this recipe as instructed above and got just blank pages. Explicit instructions would be highly appreciated. Sichendra, 2006-03-02
I'm working on a better explanation, including a full sample setup. jjscms1_2.php with improved url rewriting code will be released shortly. Jens, 2006-03-05
Eagerly look forward to it. Any specific date of release? And I would love to know whether the new release will be compatible with all other recipes? Thanks, Jens. Sichendra, 2006-03-06
Due to the way it works, jjscms should not break pmwiki with most recipes. It is however not aware of any access restrictions! Even password protected pages will be copied to the publish directory. Jens, 2006-03-06
Still working on the next release. Major changes: Copy is only written on demand (action=jjscmspublish). New features are: Password protection for publishing and an approval mechanism (also password protected) using custom PageAttributes. Jens, 2006-03-13
Versionsdate of publication : 2005-09-10 : jjscms - version 1.0date of publication : 2006-01-20 : jjscms - version 1.0date of publication : 2006-03-18 : jjscms - version 1.4beta1date of publication : 2006-03-19 : jjscms - version 1.4beta2date of publication : 2006-03-21 : jjscms - version 1.4beta3
See AlsoContributorsCategory: CMS
|