[pmwiki-users] Getting attachlist count

Petko Yotov 5ko at 5ko.fr
Wed Mar 6 23:53:37 CST 2013


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}.

If you want the count of only some files, eg. pictures, or exclude some  
files - deleted files or thumbnails, I don't think we have such a recipe yet.

Petko




More information about the pmwiki-users mailing list