[pmwiki-users] Pagelists and PTV (updated)

Christian Moser christian.moser at theol.uzh.ch
Thu Dec 22 10:06:02 CST 2011


Dear Knut

Wow, that looks brilliant! Many many thanks!

Unfortunately I get the message: "Warning: cannot modify header 
information - headers already sent by (output started at 
...\cookbook\collectinc.php:73) in ...\pmwiki.php on line 1151"

I wasn't quite sure where to put the script ("collectinc.php"), si I 
just put it into my cookbook and added in config.php:
include_once("$FarmD/cookbook/collectinc.php");

Did I get something wrong?

Kind regards
Christian





Am 21.12.2011 23:22, schrieb Knut Alboldt:
> Hi !
>
> As Peter said: you have to write a short script - like this:
>
> e.g. collect.incphp:
> ==============================
> <?php
>
>   $Collected = array();
>
> /*
>   (:collect key values:)
>
>   in a pagelist template:
>
>
> === Page Test.Collect ===
> (:pagelist name=Test.Collect-* fmt=#collect:)
>
>
> ----
> :pagelist format:
>
>  [@
> [[#collect]]
> (:template first:)
> :collecting keys and values:
> (:template each:)
> * collecting: keys="{=$:years}" value="{=$Title}" (you can delete this)
> (:collect keys="{=$:years}" value="{=$Title}":)
> (:template last:)
> :Output the result:
> (:collected:)
> [[#end]]
> @]
>
> === Page Test.Collect01 (etc) ===
>
> (:title Collect - 01:)
>
> :years:1951, 1952, 1953
>
> === end ===
>  */
> Markup('collected','directives','/\(:collected:\)/e','Collected()');
>
> Markup('collect','directives',
>     '/\(:collect\s?+(.*):\)/e','Collect("$1")');
>
> function Collected()
> {
>   global $Collected;
>   $text = "";
>
>   ksort($Collected);
>
>   foreach ($Collected as $key => $values)
>   {
>     $text .= "* $key $values\n";
>   }
>   return PRR($text);
> }
> function Collect($args)
> {
>   global $Collected;
>
>   $args = ParseArgs($args);
>
>   $keys   = preg_split("/,/",$args['keys']);
>   $value  = $args['value'];
>
>   foreach ($keys as $key)
>   {
>     $key = trim($key);
>     $Collected[$key] .= $value . " ";
>     $debugtext .= "** DEBUG: $key: $value\n";
>   }
> }
> ?>
>
> ==============================
>
> in your config-file include this file using:
>
>     require_once("collect.incphp");
>
>
> Should work.
>
> Regards
>
> Knut
>
>
> Am 21.12.2011 10:30, schrieb Christian Moser:
>> Hi everybody
>>
>> I wondered whether the following could be accomplished somehow.
>>
>> Let's assume I have two pages:
>>
>> (:title First:)
>> (:ptv:1850, 1851, 1854:)
>>
>> and
>>
>> (:title Second:)
>> (:ptv:1852, 1853, 1855:)
>>
>>
>> Is there a way to have a pagelist output (with a local pagelist
>> template) like this:
>>
>> 1850 First
>> 1851 First
>> 1852 Second
>> 1853 Second
>> 1854 First
>> 1855 Second
>>
>> Many thanks in advance!
>> Christian
>>
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>>
>


-- 
Christian Moser, Dr. des.
Oberassistent
Redaktion Zwingliana
Universität Zürich
Institut für Schweizerische Reformationsgeschichte
Kirchgasse 9
CH-8001 Zürich
+41 (0)44 634 47 59

christian.moser at theol.uzh.ch
www.irg.uzh.ch/personen/moser.html




More information about the pmwiki-users mailing list