如何在 Jahia 6 CMS 中设置日期格式?
我正在帮助我的一个朋友为他的企业建立一个网站。我读过不同的帖子和网站,试图找到理想的 CMS 工具,但人们对于什么是最好的有不同的看法,所以我最终只是随机选择了其中一个。
所以我对Jahia 6.0-CE进行了评估。您现在可能已经猜到了,我对 CMS 工具没有太多经验。我只想设置 CMS,为网站编写模板,然后让我的朋友从那里管理内容。
所以我从 SVN 中提取了源代码并进行了测试。我设法创建了一些简单的模板来掌握一些事情,但现在我遇到了日期格式的问题。 在我的definitions.cnd中,我像这样声明了该字段:
date myDateField (datetimepicker[format='dd.MM.yyyy'])
这是在页面中格式化的,并且选择器在插入内容时也会以dd.MM.yyyy格式显示它。但是其他国家/地区的网站怎么样,例如将日期表示为 MM.dd.yyyy 的国家/地区?
如果我在 CND 中指定格式(硬编码),我以后如何更改它,以便它根据浏览器的语言进行调整?我是否从存储库中提取内容并在基于区域设置的 JSP 模板中手动对其进行格式化,还是有更好的方法?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
事实上,当在 CND 中指定格式时,您必须“手动”在此 jsp 中进行格式化。您可以使用 jst 和 fmt 标记,这样您的模板(jsp 文件)中就会有类似这样的内容:
您可以将模式设置为当前本地模式。
问候。
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:
You can set the pattern to the current local ones.
Regards.
要快速获得有关 jahia 模板的答案,或者,您可以访问专用网站 Jahia.org
To get fast answers about jahia templating, or else, you can go on the dedicated website Jahia.org
仅供参考,您可以在不到一分钟的时间内在 https://sso 上创建一个 Jahia 论坛帐户。 jahia.com/cas/casRegister.jsp
FYI you can create an account into the Jahia forum in less than one minute at https://sso.jahia.com/cas/casRegister.jsp