You've got two separate problems here:
1) choosing which component to render at runtime without a fixed list of possibilities
2) pulling the template from the database

The first problem is addressed by Michael Henderson's DynamicBlock:
http://www.behindthesite.com/blog/C1931765677/E1630021481/
http://www.behindthesite.com/blog/C1931765677/E20060309215538/index.html

I posted something on the second problem a while ago:

http://www.mail-archive.com/users@tapestry.apache.org/msg06927.html

You should be aware that (as far as I know) tapestry cannot remove individual pages from its page cache so you can't modify a template and see the changes immediately unless you either have page caching turned off or you use the reset service to wipe the whole cache. Neither of those are acceptable for a production environment. The solution I came up with versions the templates and calls them by ID. I have another class lying around that keeps track of the most recent component ID for a given name.

The really fun stuff was integrating this with the DynamicBlock component and our user preference system to produce a component that took a user attribute name, looked up that attribute for the current user and displayed the correct component.

-Steve

Moore, Andrew wrote:
Hi,
I'm planning on writing a content management system in Tapestry.
The plan is that the users should be able to write and design their own html
pages, and then with a simple tapestry reference (with all the properties
set in a page specification) get all the dynamic content entered into their
html pages.

If there was only one template that everybody used this would be simple, but
as I want each user to be able to design their own template, I'm not sure if
this is possible.

As far as I am aware (and I'm a complete newbie to Tapestry) as the .html
files live inside the WEB-INF directory with the .page files there probably
isn't an easy way to do this.

Is there any way at run time of dynamically choosing the template (.html)
file that is used to generate the page?  - pulling a template name from a
database?

Cheers
Andrew



**********************************************************************

Across the UK, mobile phone chargers left plugged in waste over £60 million and 
are responsible for a quarter of a million tonnes of CO2 every year.

Source:  Energy Saving Trust (2007)

**********************************************************************

This e-mail is provided for general information purposes only and does not 
constitute investment or transactional advice. For  the avoidance of doubt the 
contents of this email are subject to contract and will not constitute a 
legally binding contract.

The information contained in this e-mail is confidential and intended only for 
the use of the addressee. If the reader of this message is not the addressee, 
you are hereby notified that you have received this e-mail in error and you 
must not copy, disseminate, distribute, use or take any action as a result of 
the information contained in it.
If you have received this e-mail in error, please notify [EMAIL PROTECTED] (UK 01384 275454) and delete it immediately from your system. Neither Npower nor any of the other companies in the RWE Npower group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses.
RWE Npower plc. Registered Office: Windmill Hill Business Park, Whitehill Way, 
Swindon SN5 6PB. Registered in England and Wales: number 3892782. This e-mail 
may be sent on behalf of a member of the RWE Npower group of companies.

**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to