[pmwiki-users] Multiple CategoryGroups: 404 header
Petko Yotov
5ko at free.fr
Tue Sep 26 12:25:20 CDT 2006
On Tuesday 26 September 2006 18:25, you wrote:
> However, in the meantime you can get PmWiki to not return 404
> result codes for pages in those groups. The easiest way may
> be to create a per-group configuration file for each group
> that contains:
>
> <?php if (!defined('PmWiki')) exit();
> $DefaultPageTextFmt = '';
> $PageNotFoundHeaderFmt = 'HTTP/1.1 200 Ok';
>
Thank you, Patrick, this works! I am very happy as I've been tinkering for 3
days without success. Wow! :-) :-)
> > I tried to copy and adapt the code from stdmarkup.php to config.php:
> >
> > $pagename = ResolvePageName($pagename);
> > ## [[?Tag]]
>
> FWIW, using separate punctuation characters for each extra
> category *could* lead to some problems down the road, especially
> since some of them (such as '?') already have another meaning in
> certain contexts.
>
> In reality, there's not much special about the [[!Category]] markup;
> one can create categories in other groups just by using the
> groupname:
>
> [[Category/XYZ]]
> [[Tags/XYZ]]
> [[ProjectCategory/XYZ]]
>
It *is* special, because if there is no such category, the link renders as a
normal link. The tip from Martin Fick (thanks Martin!) to patch pmwiki.php
will probably do the job for the price of some inconviniences on upgrades.
But when I copy the code for the !Category it works, because ot the 'L'
variable in:
Markup('[[!','<[[','/\\[\\[!(.*?)\\]\\]/e',
"Keep(MakeLink(\$pagename,PSS('$CategoryGroup/$1'),NULL,'',
\$GLOBALS['LinkTagFmt']),'L')
I believe this 'L' causes the pmwiki.php function LinkPage to skip the
PageExists check for the target page.
But from your suggestion about future problems and for the sake of simplicity,
I am considering adding markups, containing the group names:
$MyCatGroups = array("Tag", "ProjectCategory", "ContactCategory");//etc.
foreach($MyCatGroups as $v)
{
Markup("[[$v",'<[[!','/\\[\\[$v\\/(.*?)\\]\\]/ie',
"Keep(MakeLink(\$pagename,PSS('$v/$1'),NULL,'',
\$GLOBALS['LinkCategoryFmt']),'L')");
}
One should also add spaced variants as "Project Category"; and /i as modifier.
It is probably more logical, better and saver to use such approach than
[[?tag]], [[%project]], [[:calendar]] etc. But longer.
Best regards and thanks again,
Petko
More information about the pmwiki-users
mailing list