[pmwiki-users] A few technical questions

Patrick R. Michaud pmichaud at pobox.com
Mon Nov 14 08:28:50 CST 2005

On Sun, Nov 13, 2005 at 01:32:19PM -0500, Ryan Varick wrote:
> I'll start with an easy question... what is 'SDV' for?  I see it used
> all over, what does it do?

"Set Default Value".  The call

    SDV($SomeVar, "value");

assigns "value" to $SomeVar only if $SomeVar doesn't already have
a value.  This allows PmWiki and scripts to set default values on
a variable but let an administrator's settings (in local/config.php)
override the default.

> Next, I would like to better integrate my blog post form
> (http://www.ryanvarick.com/Blog/Post) with PmWiki's edit behavior, for
> two reasons:
> 1) Allow skins to act like they are in edit mode.
> 2) Allow better integration with the default PmWiki edit form.
> I gather that skins usually check for "action=edit" to do something,
> like hide the sidebar.  Is there some way I can kick PmWiki into edit
> mode?  Or add my own action?

Skins no longer have to hide the sidebar directly, the edit form
is now normally held in the Site.EditForm page.  Adding the markup
"(:noleft:)" to this page causes the sidebar to be hidden when
editing a page.

New actions are added via the $HandleActions array; each entry is
the name of the subroutine to be called when ?action=... is

> As for post form integration, is there a way I can "piggy-back" on the
> current edit form?  I'd like to use the edit form the user has already
> set up, maybe adding a couple of fields (like subject, date, and a
> hidden field).  Is this possible?  Right now I have my own form
> configured, is there a better way to do this?

New input fields can be added to the edit form by editing the
Site.EditForm page.  Processing them requires more work, but all
editing functions are handled through the $EditFunctions array
(which is an array of subroutines to be called in order to process

> My next issue is with the digest
> (http://www.ryanvarick.com/Blog/Digest).  I'm using this code to
> expand the (:blogdigest:) directive.
> Markup('blogdigest', 'directives',
>     "/^\(:blogdigest?\s+($GroupPattern)[.\/]($NamePattern):\)\s*$/e",
>     "'<:block>'.view_blog_digest(\$pagename,'$1','$2')");
> ...
> view_blog_digest() reads in a wiki page, runs a regex against it, and
> finally runs the result through MarkupToHTML().  It then returns the
> formatted HTML.  My problem is that somewhere, in PmWiki, conversion
> seems to be happenning again.  That is, links that are stored as [[wik
> links]] are converted to <a href>s by my code, then PmWiki goes
> through and expands the URL again, as you can see on the digest page.
> I'm probably using Markup() wrong, so what should I do fix this?  

You probably want to be using Keep(), which preserves text so that
PmWiki doesn't do any further processing of the text.  Otherwise,
PmWiki is seeing the urls in the resulting text and placing
<a ...> tags around them as it is supposed to.

Another possibility is to make sure the blogdigest markup
gets converted sometime later in the sequence, i.e., after links
have been processed.


More information about the pmwiki-users mailing list