cancel
Showing results for 
Search instead for 
Did you mean: 

Getting started with Templates

edfactor
Champ in-the-making
Champ in-the-making
Hello Alfresco Team -

First, thanks for doing such a fantastic job. 

I am trying to get started with creating templates.  The wiki docs (which I have read thoroughly) are decent, but I can't figure out how to get started.  I don't understand when the templates get processed, or by whom.  If I wanted to change what appeared when someone visited my space, is that something I can do with a template?  I can see from the wiki docs what a template looks like, but I don't know where to begin. (I saw the examples on the wiki, but where do they go - do I just drop one in the templates directory?)

What are the high-level tasks to change what appears when someone visits my project space?

Thanks.

Ed
6 REPLIES 6

kevinr
Star Contributor
Star Contributor
Hello,

Thanks for your kind comments Smiley Happy

Sorry we didn't include any example templates yet with the distribution files.

At the moment we have not exposed the templating features much in the web-client. The potential however is huge, they could be used to generate whole web-sites or customise views and spaces etc. as you suggest.

At the moment, templates can be seen like this:

1. Create a template file (probably best to copy-and-paste an example from the Wiki docs you mentioned).
2. Add the template file you created to the "Company Home/Data Dictionary/Content Templates" folder in your repository.
3. Add the Templatable aspect to a document of your choice (you can do this either using a Space Rule or using the "Run Action" menu option in the Details page for a document)
4. Click the new icon "Preview" that now appears next to the document in the main browsing screen.
5. The screen that appears has a drop-down menu in the top right of the screen, this shows a list of the available templates found the Content Templates folder as above. When you select one it is applied to the current document.

Hopefully this gives you enough to have a play with the templating language.

From a development perspective, the templating features are exposed as a JSF component <r:template … > which can be placed on any web-client JSP page to display the results of a template. See the wiki docs for more info on this component.

Thanks,

Kevin

edfactor
Champ in-the-making
Champ in-the-making
OK! Thanks very much! This is a big help for content templates.

By the number of page views, I can tell this is an issue for lots of people.  I will give this a try and post how far I got!  I highly recommend cutting and pasting your reply to somewhere in the Wiki template guide.

Ed

p.s.  I am working at a big company where me and a few guys are trying to get something decent up and running in time to ward off Sharepoint! So your help is much appreciated! 🙂

kevinr
Star Contributor
Star Contributor
Hello,

Glad to hear that helped! Smiley Happy I have edited the Wiki docs as you suggested.

We can fully understand your motivation to head off SharePoint, I'm sure you'll be much better off with access to the rich world of open source software and not being tied to the monolithic Microsoft stack…!

Any further questions please let us know.

Cheers,

Kevin

kevinr
Star Contributor
Star Contributor
Latest Template Guide documentation for Alfresco 1.1 now available, including information on XML Node processing in templates, dashboard views and using/configuring the new Template Service in the repository.

http://www.alfresco.org/mediawiki/index.php/Template_Guide

Thanks,

Kevin

boa
Champ in-the-making
Champ in-the-making
Hi,

I am interested in applying XSLT-based templates to XML documents to generate HTML and PDF output. What would be the steps required to replace the current templating engine with an XSLT processor like Saxon.

Also i am interested in creating a content transformer for XML to HTML and XML to PDF output using Saxon and FOP. What's the right way to do this.

Thanks in advance

davidc
Star Contributor
Star Contributor
For your second question, you may find http://www.alfresco.org/mediawiki/index.php/Content_Transformations  useful.