if you named the script collectinc.php (and not collect.incphp) then have a look to that file:

Please check: before the first "<?php" = 1. line and after the last "?>" = last line should be no spaces or lines.

Placement of the file and include is quiet ok.

If you can't get it, please send me the collectinc.php-file as an attachment, then I'll have a look.

Regards

Knut

Am 22.12.2011 17:06, schrieb Christian Moser:

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
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users





_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to