[pmwiki-users] Categories in a own textfield
nexyufuli evo
noskule at gmx.net
Mon Sep 19 05:23:36 CDT 2005
Patrick R. Michaud schrieb:
>On Fri, Sep 16, 2005 at 02:09:14PM +0200, nexyufuli evo wrote:
>
>
>>Patrick R. Michaud schrieb:
>>
>>
>>>On Fri, Sep 16, 2005 at 12:02:48PM +0200, nexyufuli evo wrote:
>>>
>>>
>>>
>>>>I would like to use a sparate textfield for editting the category names.
>>>>Cause for one project it is nessesary that every page has categories.
>>>>So, if the textfield is emty, i can make a errormessage.
>>>>
>>>>
>>>Instead of creating a separate textfield for this, we could write
>>>an edit filter that requires at least one category be present in
>>>the markup, otherwise it doesn't save the page and returns back
>>>to the edit form with an error message.
>>>Would that work?
>>>
>>>
>>>
>>yep, this would be cool to.
>>
>>
>
>Here's code to require a page to have at least one category in it
>(it actually looks for "[[!") before the page can be saved:
>
> function RequireCategory($pagename, &$page, &$new) {
> global $EnablePost, $MessagesFmt;
> if (isset($_POST['text']) && strpos(@$new['text'], '[[!') == false) {
> $EnablePost = 0;
> $MessagesFmt[] = "<h3 class='wikimessage'>The page must contain at
> least one category</h3>";
> }
> }
>
> array_unshift($EditFunctions, 'RequireCategory');
>
>You can see this work at http://www.pmwiki.org/wiki/Test/CategoryRequired .
>
>Pm
>
>
>
>
jep this works great. I did change the $MessagesFmt[] to
$MessagesFmt[] = "<h3 class='wikimessage'>Die Seite muss vor dem speichern
mit einer Kategorie versehen werden! Siehe: <a
href='$ScriptUrl/WikiHilfe/KategorienAnlegen'>WikiHilfe.KategorienAnlegen</a></h3>";
But $ScriptUrl gives me unlike in the template just the domainname.
http://netstreams.org instead of http://netstreams.org/netstreams/wiki.php
Is this susposed to work?
thanx nos
More information about the pmwiki-users
mailing list