How to format dates in Jahia 6 CMS?
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 fi开发者_JAVA百科eld 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.
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.
To get fast answers about jahia templating, or else, you can go on the dedicated website Jahia.org
FYI you can create an account into the Jahia forum in less than one minute at https://sso.jahia.com/cas/casRegister.jsp
精彩评论