[opencms-dev] How to associate downloads with pages?

Tristan Roddis tristan at roddis.org
Wed May 14 11:42:02 CEST 2003

I need to let site administrators assign downloadable files to any page 
within the site, and have them appear as a prettily-formatted table at the 
bottom of the page with the following fields:

Title, file size, file type

Because the design dictates that these need to be in a table, then I can't 
just use the standard HTML page editor, as our administrators don't know 
HTML [plus the downloads function doesn't seem to work in 4.6.6 :) - see 
thread 'Ledit is driving me crazy')] 

So, I was wondering if anybody had any suggestions as to the best (and 
most OpenCMS-like) way of doing this?

Essentially I can see two problems: 1) where to store the information that 
associates download files with pages and 2) how best to let the user 
assign downloads to pages. 

For 1) I can think of:

a) in a new database table (two columns: pageUri and downloadUri)
b) in an XML definition file somewhere in the VFS (lots of blocks along 
the lines of:
<page name="/website/section/foo.html">
c) as a Property of the page (along the lines of 
Downloads: /downloads/gallery1/bar.doc,/downloads/gallery2/baz.pdf )
d) other (please state)

Then my display class can read from one of the above, get the resource
title, filesize and type, and insert some prettily-formatted HTML as a
data block into the display template.

For 2) I can think of:

a) A module or other admin template that will firstly allow a user to 
select a page, and secondly allow a user to add and remove the downloads 
assigned to the page
b) Adding/reusing a button on the HTML editor to allow users to assign 
downloads to that page
c) other (please state)

Has anybody got any opinions on which of the above choices would be best?  
Factors to consider include i) how easy is it to implement and ii) how
well does it fit in with the rest of OpenCMS (e.g. I'd imagine that
reading a page's properties is easier and more OpenCMS-like than using a
sepearate database table). Efficiency isn't a great concern as it's a very
small site, and we'll be using static export.

Also, any pointers or tips for how to use any exisiting OpenCMS components 
(e.g. the file picker or the download gallery selection pages) would be 
greatly appreciated.

Thanks in advance,


tristan at roddis.org                              http://www.roddis.org
"Software without secrets."                      http://www.linux.org

More information about the opencms-dev mailing list