views:

106

answers:

3

I am helping a friend of mine put up a site for his business. I’ve read different posts and sites trying to find the ideal CMS tool, but people have different views of what is the best, so I finally just picked one of them at random.

So I went for an evaluation of Jahia 6.0-CE. As you’ve probably guessed by now, I don’t have so much experience with CMS tools. I just want to setup the CMS, write the templates for the site and let my friend manage the content from there on.

So I extracted the sources from SVN and went for a test drive. I managed to create some simple templates to get a hang of things but now I have an issue with a date format. In my definitions.cnd I declared the field like so:

date myDateField (datetimepicker[format='dd.MM.yyyy'])

This is formatted in the page and the selector also presents this in the dd.MM.yyyy format when inserting the content. But how about sites in other countries, countries that represent the date as MM.dd.yyyy for example?

If I specify the format in the CND, hard coded, how can I change this later on so that it adapts based on the browser’s language? Do I extract the content from the repository and format it by hand in the JSP template based on a Locale, or is there a better way?

Thank you.

A: 

Hi,

Indeed, when a format is specified in the CND, you have to formated in this jsp "by hand". You can use jst and fmt tags, so you will have in your template (jsp file) someting like that:

<fmt:formatDate pattern="yyyy-MM-dd" value="${myDate}"/>

You can set the pattern to the current local ones.

Regards.

ktlili
Just one addition. To retrieve the date value before formatting, you use the <template:field> tag like so:<template:field name="myDateFieldNameFromCND" valueBeanID="myDate" display="false" />
dpb
A: 

To get fast answers about jahia templating, or else, you can go on the dedicated website Jahia.org

Clement
I first looked for an answer on Jahia's forum, but I don't have an account there to post questions.
dpb
A: 

FYI you can create an account into the Jahia forum in less than one minute at https://sso.jahia.com/cas/casRegister.jsp