如何同时使用多个主题

编程入门 行业动态 更新时间:2024-10-26 00:19:01
本文介绍了如何同时使用多个主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一种在一个 XPage 应用程序中使用多个主题的方法,每个主题都在应用程序的不同部分中处于活动状态.例如,支持具有面向公众的网站(自定义主题)和具有 OneUI 主题的 CMS 的单个 .nsf 应用程序.

I'm looking for a way to use multiple themes in one XPages application, each theme active in a different section of the application. For instance to support an single .nsf application with both a public facing website (custom theme) and a CMS with a OneUI theme.

您可以在应用程序属性中的 XPage 属性选项卡上设置在整个应用程序中使用哪个主题.也可以使用以下代码更改用户会话的主题:

You can set which theme is used through the whole application on the XPage Properties tab in Application Properties. It's also possible to change the theme for a user's session with this code:

context.setSessionProperty("xsp.theme", <theme_id>)

但是这两个选项都为当前 .nsf 中的所有页面设置了主题,我正在寻找一种方法来为应用程序的一部分指定主题 X,为第二部分指定主题 Y.

But both options set the theme for all pages in the current .nsf, and I'm looking for a way to specify theme X for one part of the application and theme Y for a second part.

这可能吗?

推荐答案

我尝试了上述所有方法,但没有一个对我有用.但我找到了一个解决方案:

I tried all of the above, but none of them worked for me. But I found a solution:

将其粘贴到视图的 beforeRenderResponse 事件中:

Paste this into the view's beforeRenderResponse event:

context.setSessionProperty("xsp.theme", "yourAlternateThemeName")

有一个问题:一旦您使用了这种方式,您就必须始终在每个页面上使用它,因为这会设置一个会话属性,只要您登录就可以存储该属性.

There is one issue: once you have used this way you have to use it always and on every page as this sets a session property which is stored as long as you are logged in.

更多推荐

如何同时使用多个主题

本文发布于:2023-07-17 03:40:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1129038.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   主题

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!