[pmwiki-users] Images in included pages

Petko Yotov 5ko at 5ko.fr
Sat Jul 12 10:53:34 CDT 2014

Peter Schwegler writes:
> I have a page, with an attached image. When I view this page directly the  
> image is shown correctly. When I include this page in another page (also in  
> another group) all I see is "Attach:imagename" with the upload triangle.
> original page: group A.page A
> this page is included in group B.page B
> I save my uploads in a directory per page ($UploadPrefixFmt='/$Group/$Name)
> What do I need to change to see the image also in page B?

You can write in PageA.PageA one among:


Then the image will be displayed in both PageA and PageB.

(The solution to use Attach:{$Group}./image.jpg will work for wikis with the  
default $UploadPrefixFmt, not for you; this solution here should work in  
both cases of $UploadPrefixFmt.)

It is possible to instruct PmWiki to automatically insert GroupA.PageA when  
including a page. Something like this in config.php may work:

  SDV($QualifyPatterns["/(\\[\\[ *Attach:)([^\\/$UrlExcludeChars]+(\\|.*?)?\\]\\])/"],
    PCCF("\$m[1].\$pagename.'/'.\$m[2]", 'qualify'));
    PCCF("\$m[1].\$pagename.'/'.\$m[2]", 'qualify'));

This has not been extensively tested but should work in most cases for most  
attachments (pictures or not) in included pages.

Maybe I should create a Cookbook recipe and let people test the snippet so  
we can improve it before eventually include it in the PmWiki core?


More information about the pmwiki-users mailing list