[pmwiki-users] Getting attachlist count

V.Krishn vkrishn4 at gmail.com
Thu Mar 7 08:33:14 CST 2013

On Thursday, March 07, 2013 11:23:37 AM Petko Yotov wrote:
> V.Krishn writes:
> > Is there a way to get attachlist count? (directly or via template)
> If what you need is just the plain number of files in the upload directory
> related to the page, it is possible with a PageVariable, add this to your
> config.php:
>     $FmtPV['$NbAttachments'] = 'AttachExist("$group.$name")';
> Then, in a page use {$NbAttachments}, {*$NbAttachments} or
> {OtherPage$NbAttachments}, and in a pagelist template use
> {=$NbAttachments}.

Thanks, this would do.
I was wanting to add it to page properties in Notebook app.

Using the above, I am doing the following:
$FmtPV['$AttachCount'] = 'AttachExist("$group.$name")';
Then on properties page:
(:if ! equal {*$AttachCount} 0:)({*$AttachCount})(:if:)

I was thinking similar to pagelist.
Something like,
(:attachlist PageName count:)
(:attachlist PageName fmt=count:)
or as above example, but as core Pmwiki pagevar
$FmtPV['$AttachCount'] = 'AttachExist("$group.$name")';


More information about the pmwiki-users mailing list