Thursday, January 31, 2008, 9:18:10 AM, imoc wrote:
>> $FmtPV['$Creator'] = 'PageCreationAuthor($pagename)';
>> function PageCreationAuthor($pagename) {
>> $page = RetrieveAuthPage($pagename, 'read', true);
>> foreach($page as $key => $value)
>> if (strstr($key,'author'))
>> $authors[$key] = $value;
>> return end($authors);
>> }
>>
> Hi Hans, I add these code in 'config.php' and put {$Creator} variable in
> 'Site.PageAction' like 'Post by {*$Creator}'. It worked in every page
> except new page. While creating new page, there is a warning:
> Warning: end() [function.end]: Passed variable is not an array or
> object in /home/jbooknet/public_html/tw/local/config.php on line 121
> In my config.php the line 121 is:
> return end($authors);
For a new page there is no author set in the page attributes.
Try this:
$FmtPV['$Creator'] = 'PageCreationAuthor($pagename)';
function PageCreationAuthor($pagename) {
$page = RetrieveAuthPage($pagename, 'read', true);
foreach($page as $key => $value)
if (strstr($key,'author'))
$authors[$key] = $value;
if (is_array($authors))
return end($authors);
else return '';
}
or perhaps the last line could also be
else return '{$Author}';
~Hans
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users