[pmwiki-users] markup:

DaveG pmwiki at solidgone.com
Tue Dec 13 22:10:40 CST 2005


The problem was that $label evaluated to "Categories" (with variables 
$McatLabelP and $McatLabelS) which subsequently got processed by markup: 
with nothing returned. I eventually realized that defining $label as 
"[=Category=]" or "[=Categories=]" resolved the problem.

  ~ ~ Dave

DaveG wrote:
> Thanks for taking the time to test that.  :)
> 
> My goal, is to get a nicely sorted and formatted list of categories put 
> in the header in the template. I'd like something like "Tags: A | B | 
> C". The MediaCategories seemed to do what I needed.
> 
> I'm using a modification of the Cookbook/MediaCategories. I've modified 
> the markup:
> Markup('multicat','<[[!','/(\\[\\[!.*\\]\\])$/e', 
> "PZZ(\$GLOBALS['Categories']=Multicat('$1'))");
> 
> and simplified the function since I'll put div tags in the template for 
> greater flexibility:
> function Multicat($input) {
>     global $McatLabelS, $McatLabelP, $McatSep;
>     $categories      = preg_split('/\s+/', $input);
>     sort($categories);
>     $label           = (count($categories) > 1) ? $McatLabelP : 
> $McatLabelS;
>     $input           = implode($McatSep, $categories);
>     return "$label $input";
> }
> 
> My idea was to define a global which can be referenced from the template 
> -- same as the previous thread with Trails. What appears to be happening 
> is that:
> 1] Markup->multicat calls function Multicat and correctly sets the global
> 2] I use markup:$Categ in the template. This causes the Markup-multicat 
> to fire again, calling the function Multicat, which tries to process 
> "[[!AAA]] | [[!BBB]]" and fails, returning nothing.
> 
> So, either I'm using the wrong approach again, or the function can be 
> modified to determine it's running a second time, or markup: has some 
> parameter to prevent user defined markups (seems unlikely, and not too 
> useful).
> 
> Suggestions?
> 
>  ~ ~ Dave
> 
> Patrick R. Michaud wrote:
> 
>> On Tue, Dec 13, 2005 at 01:58:58PM -0500, DaveG wrote:
>>
>>> What processing/rules does markup: adhere to?
>>>
>>> Code:    <!--markup:Tags: [[!AAA]] | [[!BBB]] | [[!CCC]]-->
>>> Result:  "<p>Tags: </p>";
>>>
>>> Or:
>>> Code:   <!--markup:[[!AAA]]-->
>>> Result: ""
>>>
>>> What I was expecting was a link to the page category AAA.
>>
>>
>>
>> It's supposed to do anything that markup would do, including handling
>> the markups you've given above.  In fact, I just tried the above in a
>> skin on pmwiki.org and they all worked fine (see the links at the top
>> of the sidebar at http://www.pmwiki.org/wiki?skin=sw).  So, there must
>> be something else going on here....
>>
>> Pm
>>
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list