Hi Eric

I think I got it.

But keep in mind, that all web pages are based on a template. So if you have a property added to the template, that value is same for all web pages build with that template. If you change the value, again, it's going to be same for all web pages. Another issue you may be confronted with: What if you want to change the value? You will need a developer to do so (if you don't want authors to fummel around with templates). So still think twice if you really don't want to decouple these values from the template.

There is a way to determine with which template a web page has been build with. Class "info.magnolia.cms.core.Content" has a method "getTemplate()", which returns the template used for this specific web page. You then can instantiate a "Content" object based on the template handle and read the according "NodeData". Anothert method, "getMetaData()", may be interesting as well. You will receive some additional information about the web page.

hth
/giancarlo


Eric Everman wrote:

Thanks for the response Giancarlo, and the suggestions.

I really like the idea of adding a separate Config node to store project related constants - I could even see storing the css file and template related images in that fashion.

I would still like to access some properties from the page's template, however. Two main reason why: I would like to keep the page properties as 'simple' as possible so that a user can pick a template and not have to worry about config options for the page - just start adding paragraphs (within reason of course). Second, I would like to add some parameters for just that template that I can change via the admin console and all of the pages based on that template would update.

I looked at the Template API, but this doesn't seem to provide a way to find out which Template is in use for the current page - there must be a property of the page that reveals its template, but I can't seem to find the property name anywhere. Any suggestions on where to look?

Thanks again,

Eric Everman


On Sep 26, 2005, at 8:10 PM, Giancarlo F. Berner wrote:

Hi Eric

You can access Template Information bei using the class "info.magnolia.cms.beans.config.Template". Check the API Doc for more information.

But I am wondering why you want to add the property "show-left- column" to the template. Wouldn't it make more sense to keep this value individual for every webpage? Either create a Dialog and add that property there, or then add that property to the "page properties" dialog. Another possibility is to create a configuration setup in the "Config" repository, where you can create properties to fine tune your web application. For example you could create a node within Config like "myProject/internet" and "myProject/intranet" and below each node add the same property "show-left-column". This way you could use the same template for the intranet and internet and adapt the behavior according to these config parameters.

cheers
/giancarlo

Eric Everman wrote:


Hi-

I'm likely missing something really obvious, but....

How do I access template properties from the page? For instance, I have a modules/templating/Templates/some-template with a node- data entry of "show-left-column" = "true". How do I access that in a page that is using the template?

Thanks in advance,

Eric Everman


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to