Childpages

This code shows how to add images or other files to a page using the newpage snippet, counting them with countpages module, and listing them with the listpages module.

Attachments on this page: 5

Attachments

The attachments to this page are shown below:

Date Title
05 Jul 2014 15:53 The Eagles - eagles.jpg
21 Sep 2011 20:27 Attachment - cricket2.jpg
21 Sep 2011 19:56 Attachment - strathgames.jpg
21 Sep 2011 19:51 Attachment - castleopen.jpg
21 Sep 2011 18:55 Attachment - audir8-sponsored.png

Syntax

[[module CountPages category="attachment" parent="."]]
Attachments on this page: **%%total%%**
[[/module]]

@@ [[include :snippets:newpage
|size=400px
|name=Attachment
|category=attachment
|parent=childpages
|button=Add an image
|enablebutton=false
|text=Enter the title then press Enter
]]@@

(remove the @@ above)

+++ Attachments

The attachments to this page are shown below:

[[module ListPages category="attachment" parent="." order="created_at desc" separate="false" prependLine="||~ Date ||~ Title ||" appendLine="||||||~ ||"]]
|| %%created_at|%d/%m/%y%% || %%title_linked%% - %%form_data{image}%% || 
[[/module]]

The syntax on the attachment:_template page is:

@@[[include :snippets:image
|image=%%form_raw{image}%%
|width=250px
|float=
|heading=
|caption=
|link=
]]@@

(remove the @@ above)

====

[[form]]
fields:
 image:
    label: Image
    type: file
[[/form]]
Site Design, Syntax and Examples by Rob Elliott 2008-2016