Liferay的编辑速度模板更改未显示或需要一段时间 [英] Editing velocity template of Liferay changes not showing or takes a while

查看:83
本文介绍了Liferay的编辑速度模板更改未显示或需要一段时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编辑我的 portal_normal.vm (服务器/tomcat/webapps/mytheme-theme/templates)测试,是否可以在该文件上书写并在浏览器中看到它.我尝试在测试注释中加上<!-测试->"只是看我是否真的可以在文件上写.因此,我刷新了文件,希望可以看到我添加的注释,但现在还没有.因此,我继续刷新(ctrl + r)\,并查看源代码将近二十分钟.一段时间后,当我尝试再次查看它时,它会反映在我的源代码中.因此,我认为它是由Liferay或我的浏览器缓存的.

I'm currently editing my portal_normal.vm (server/tomcat/webapps/mytheme-theme/templates) testing if I can write on the file and see it on my browser. I tried putting a test comment "<!-- test -->" just to see if I can really write on the file. So I refreshed the file and hope I can see the comment I've added, but there we're none. So I continued refreshing (ctrl+r),\ and viewing the source code for almost an twenty minutes. After a while when I tried viewing it again it reflected in my source code. So I thought it was cached by either Liferay or my browser.

所以我尝试调整添加评论的版本(<!-测试v2->"),希望能看到更改.我在其他浏览器上检查了此评论,但评论未更新或未包含我添加的版本.因此,我认为Liferay对此问题负责.

So I tried tweaking the comment adding version on it ("<!-- test v2 -->"), hoping to see changes. I checked it on another browser and the comment didn't update or include my added version. So I think Liferay is responsible for the issue.

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

this is what my portal-ext.properties contain:

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文件时,可以很快看到更改.只需重新加载一次,更改就会显示出来.我认为只是在我的速度模板中需要一些时间,否则就会出问题.

Addition: When I tried editing the css files I can see the changes fast. Just one reload the the changes appear. I think it is just in my velocity template that take some time or there's something wrong.

Liferay版本::Liferay Portal社区版6.0.6 CE

Liferay version: Liferay Portal Community Edition 6.0.6 CE

谢谢!

推荐答案

实际上没有必要定义您自己的portal-developer.properties.通过将-Dexternal-properties=portal-developer.properties添加到tomcat/bin/setenv.(sh|bat)中的JAVA_OPTS中,Liferay将使用它的默认开发人员设置,该设置几乎与您提供的设置相同.但是,我认为这不会助长(或可能解决)您的问题. 此处有更多详细信息.

There is really no need to define your own portal-developer.properties. By adding -Dexternal-properties=portal-developer.properties to your JAVA_OPTS in tomcat/bin/setenv.(sh|bat) Liferay will use it's default developer settings, which are almost identical to what you have provided. However, I do not believe this is contributes to (or could resolve) your problem. More details here.

如果您要更改正确的文件,则开发人员属性确实允许您对模板进行实时更改.由于Liferay提供给已部署的Web应用程序的默认context.xml,因此将Webapp复制/缓存在tomcat/temp/{id}-webapp-name中.这意味着,如果您在webapp/mytheme中更改了模板,那么,如果根本没有注意到更改,则tomcat可能需要一段时间才能接受更改(这取决于tomcat的配置).另一方面,如果您在temp/1-mytheme中进行更改,它将立即显示.编辑temp文件夹中的文件可能不理想,所以...

The developer properties do allow you to make live changes to the templates provided you are changing the right file. Due to the default context.xml Liferay provides to the deployed webapps, the webapps are copied/cached in tomcat/temp/{id}-webapp-name. This means if you change the template in webapp/mytheme then it may take tomcat a while to pick up on the change, if it notices the change at all (this will depend on the tomcat configuration). On the other hand, if you make a change in temp/1-mytheme it will show up immediately. Editing the files in the temp folder is probably not ideal, so...

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

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

<Context cachingAllowed="false"/>

此文件应放在您计算机的META-INF文件夹中 主题.如果您正在使用Liferay自动部署功能,则 context.xml文件可能会被破坏,请在此处此处.如果这 您将需要找到最适合自己的工作方式 需求,例如在部署主题之后修改context.xml.

This file should be placed in the META-INF folder of your theme. If you are using the Liferay auto-deploy feature the context.xml file may be clobbered, here, and here. If this is the case you will need to find a work around that best suits your needs, such as modifying the context.xml after the theme is deployed.

如果您正在使用Liferay Plugin-SDK,则可以遵循

If you are using the Liferay Plugin-SDK the you can follow the fast plugin development guide for setting up your development environment.

这篇关于Liferay的编辑速度模板更改未显示或需要一段时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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