Liferay 6 - 如何将自定义布局设置为默认?

发布于 2024-12-09 11:52:36 字数 433 浏览 5 评论 0原文

我正在开发一个 Liferay 6 项目,该项目的一部分是创建一个新的布局模板,作为整个站点的默认模板。 Liferay 自己的 wiki 上关于布局模板的文档非常稀疏,而且我在 Google 搜索甚至这里的 SO 上都没有更好的运气。

我确实找到了一篇文章( Liferay - 每个页面的布局),它回答了问题,但似乎这可能有点过分了。在该问题中,目标是根据页面更改模板,因此答案是创建一个 Hook 并使用它根据需要动态设置模板。在这里,我只想让这个自定义模板始终成为所有页面的默认模板,这就是为什么我认为其他问题的答案可能比真正需要的更多。

如果有人知道这个谜题的答案,请告诉我。谢谢!

——JLM——

I'm working on a Liferay 6 project, and part of the project is to create a new layout template to be used for the entire site as the default. Liferay's own wiki is very sparse on documentation about layout templates, and I haven't had better luck with Google searches or even here on SO.

I did find one article ( Liferay - Layout for each pages ) that sort of answers the question, but it seems like it might be overkill. In that question, the goal was to change the template based on the page, so the answer was to create a Hook and use that to set the template on the fly as needed. Here, I just want to have this custom template be the default for all pages, all the time, which is why I think the answer to that other question might be more than is really needed.

If anyone has the answer to this puzzler, please let me know. Thanks!

-- JLM --

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Oo萌小芽oO 2024-12-16 11:52:36

好吧,我已经弄清楚了我的困惑。 Liferay 有两种类型的布局模板——属于主题(Liferay 项目的一种类型)的模板,以及实际的布局模板项目本身。

  • 主题中的模板是您设置网站整体页面布局的地方。主页面模板名为portal_normal.vm,是一个带有 的完整网页。标签,一个主题中的其他模板通常是页面片段。
  • 另一方面,布局模板用于在页面的主要内容区域中布置 portlet(由主题模板文件中的标签定义)。它始终是一个片段,并且只能有

    。元素或用于布置 portlet。

幸运的是,这实际上使回答我的问题变得非常容易,至少在我需要的上下文中是这样。根据 Liferay 的文档 http:// /www.liferay.com/community/wiki/-/wiki/Main/How+To+Change+Liferay+Default+Theme

注意:从 6.x 开始,您不能只使用 liferay-look-and-feel.xml 中指定的主题 ID。相反,请转至控制面板 -> 插件配置 -> 单击感兴趣的主题 -> 记下插件 ID 并使用它[作为 Portal-ext.properties 中 default.theme.id 的值]

我希望这会有所帮助其他一些人试图解决这个问题!

OK, I've figured out my confusion. Liferay has two types of layout templates -- templates that are part of a theme, which is one type of Liferay project, as well as actual layout template projects themselves.

  • The templates in a theme are where you set up the overall page layout for the site. The main page template, named portal_normal.vm, is a full web page with an <html> tag, a <head> and <body>, etc. Other templates in the theme are usually page fragments.
  • A Layout Template, on the other hand, is only for laying out the portlets in the main content region of your page (which is defined by tags in your Theme's template files). It is always a fragment and can only have <div> elements or a <table> for laying out the portlets.

Fortunately, this actually makes answering my question very easy, at least in the context that I needed. Per Liferay's documentation at http://www.liferay.com/community/wiki/-/wiki/Main/How+To+Change+Liferay+Default+Theme :

Note: As of 6.x, you cannot just use the theme id specified in the liferay-look-and-feel.xml. Instead, go to Control Panel->Plugins Configuration->Click on theme of interest->note the Plugin ID and use that [as the value for default.theme.id in portal-ext.properties]

I hope this helps some other people trying to figure this out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文