1

我目前正在编辑我的portal_normal.vm (server/tomcat/webapps/mytheme-theme/templates) 测试我是否可以在文件上写入并在我的浏览器上看到它。我尝试添加测试注释“<!-- test -->”只是为了看看我是否真的可以在文件上写。所以我刷新了文件,希望我能看到我添加的评论,但我们没有。于是我继续刷新(ctrl+r),\查看源代码将近二十分钟。过了一会儿,当我再次尝试查看它时,它反映在我的源代码中。所以我认为它是由 Liferay 或我的浏览器缓存的。

所以我尝试调整评论添加版本(“<!-- test v2 -->”),希望看到变化。我在另一个浏览器上检查了它,评论没有更新或包含我添加的版本。所以我认为 Liferay 应对这个问题负责。

这是我的portal-ext.properties包含的内容:

auth.token.check.enabled=false

# Database settings
jdbc.default.jndi.name=jdbc/LiferayPool

#For removing captch
captcha.check.portal.create_account=false

session.enable.phishing.protection=false

default.regular.theme.id=my_site_WAR_my_theme

#Delete cookies while deleting session
session.enable.persistent.cookies=false

#redirecting null problem.
redirect.url.security.mode=mysite.com

journal.template.velocity.restricted.variables=

admin.email.from.name=Market.Travel Team
admin.email.from.address=admin@mysite.com

# Added because of the Error - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
hibernate.current_session_context_class=thread

session.enable.url.with.session.id=false

和我的portal-developer.properties

theme.css.fast.load=false
theme.images.fast.load=false

javascript.fast.load=true
javascript.log.enabled=true

layout.template.cache.enabled=false

browser.launcher.url=

combo.check.timestamp=true

freemarker.engine.cache.storage=soft:1
freemarker.engine.modification.check.interval=0

openoffice.cache.enabled=false

velocity.engine.resource.manager.cache.enabled=false

com.liferay.portal.servlet.filters.cache.CacheFilter=false

com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter=true

另外:当我尝试编辑 css 文件时,我可以快速看到更改。只需重新加载更改就会出现。我认为只是在我的速度模板中需要一些时间或者有问题。

Liferay 版本: Liferay Portal Community Edition 6.0.6 CE

谢谢你!

4

1 回答 1

1

真的没有必要自己定义portal-developer.properties。通过添加-Dexternal-properties=portal-developer.properties到您JAVA_OPTStomcat/bin/setenv.(sh|bat)Liferay 中,将使用它的默认开发人员设置,这与您提供的几乎相同。但是,我认为这不会导致(或可以解决)您的问题。更多细节在这里

只要您更改正确的文件,开发人员属性确实允许您对模板进行实时更改。由于context.xmlLiferay 为已部署的 webapps 提供默认设置,webapps 被复制/缓存在tomcat/temp/{id}-webapp-name. 这意味着如果您更改模板,webapp/mytheme那么如果它注意到更改,tomcat 可能需要一段时间才能接受更改(这将取决于 tomcat 配置)。另一方面,如果您进行更改,temp/1-mytheme它将立即显示。编辑临时文件夹中的文件可能并不理想,所以...

如何解决此问题:(无特定顺序)

  • 防止 Tomcat 为您的主题使用临时目录。为您的主题创建一个context.xml文件。

    <Context cachingAllowed="false"/>

    这个文件应该放在META-INF你的主题文件夹中。如果您使用 Liferay 自动部署功能,则 context.xml 文件可能会被破坏,这里这里。如果是这种情况,您将需要找到最适合您需求的解决方法,例如在部署主题后修改 context.xml。

  • 如果您使用 Liferay Plugin-SDK,您可以按照快速插件开发指南来设置您的开发环境。

于 2012-11-20T17:53:29.520 回答