如何同时使用多个主题 [英] How to use multiple themes at the same time

查看:54
本文介绍了如何同时使用多个主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在一个 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.

这篇关于如何同时使用多个主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆