java 将 html 内容添加到 Liferay 中的页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1914217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add html content to a page in Liferay
提问by Tim
Im new to Liferay . I have downloaded the Liferay Tomcat bundle v5.2.3 Community Edition from the Liferay website. I am able to run it successfully. I am now trying to create an intranet portal for our company using Liferay . I created an Organization in Liferay and added some pages and child pages to it. How to add content to a page ?. I mean, i would like to add some text and images etc to the home page and other pages on the portal. I tried the Web Content Display portlet, but it always appears minimized and i have to maximise it by clicking on the maximize button. And also the option to minimize/maximize the portlet is available only when im logged in. Is there any other way to add HTML content to a page, to make it look like a normal html page which anybody can view when they visit the portal ?
我是 Liferay 的新手。我已经从 Liferay 网站下载了 Liferay Tomcat bundle v5.2.3 Community Edition。我能够成功运行它。我现在正在尝试使用 Liferay 为我们公司创建一个 Intranet 门户。我在 Liferay 中创建了一个组织并添加了一些页面和子页面。如何向页面添加内容?我的意思是,我想在门户网站的主页和其他页面中添加一些文本和图像等。我尝试了 Web Content Display portlet,但它总是显示为最小化,我必须通过单击最大化按钮将其最大化。还有最小化/最大化 portlet 的选项只有在我登录时才可用。有没有其他方法可以将 HTML 内容添加到页面,使其看起来像一个普通的 html 页面,任何人在访问门户时都可以查看?
Thank You.
谢谢。
回答by ewernli
Web Content Display is indeed the easiest choice. You probably just made a mistake when using it.
Web Content Display 确实是最简单的选择。您可能只是在使用它时犯了一个错误。
- Add the web content display portet
- Click on "add web content" icon at the bottom-left of the portlet
- You get a rich text editor, but you can also toggle to HTML view
- When you're done click on "Save and approve".
- 添加 Web 内容显示 portet
- 单击 portlet 左下角的“添加 Web 内容”图标
- 你得到一个富文本编辑器,但你也可以切换到 HTML 视图
- 完成后单击“保存并批准”。
Liferay CMS is built on the concept of template, structure and article.
Liferay CMS 建立在模板、结构和文章的概念之上。
- structure: the element to be rendered, e.g. one text area + one image
- template: the rendering of the structure, e.g. image in top-left + text around the image
- article: the actual data that corresponds to a structure
- 结构:要渲染的元素,例如一个文本区域+一个图像
- 模板:结构的渲染,例如左上角的图像+图像周围的文本
- 文章:对应一个结构的实际数据
But you should be able to edit your first Web Content Display without having an structure nor template. But I suggest you to have a look at them once your are used to the portal.
但是您应该能够在没有结构或模板的情况下编辑您的第一个 Web 内容显示。但我建议您在习惯门户网站后看看它们。
回答by Rob
Once you have added the web content portlet and then added content, you need to configure the layout template you want. Choose the one column layout to let the portlet take up the whole screen.
添加 Web 内容 Portlet 并添加内容后,您需要配置所需的布局模板。选择一列布局让 portlet 占据整个屏幕。
回答by mcgyver5
I think you are asking how to create a new page of type web content.
我想您是在问如何创建类型为 Web 内容的新页面。
- note the content_id of your web content
- make sure your web content is approved, published, and viewable (permissions)
- create your page, entering your content_id into the Web Content ID field
- 请注意您的网络内容的 content_id
- 确保您的 Web 内容获得批准、发布和查看(权限)
- 创建您的页面,在 Web Content ID 字段中输入您的 content_id
I think when you do it this way, you forsake some of the portlet functionality that Liferay brings you.
我认为当您这样做时,您就放弃了 Liferay 为您带来的一些 portlet 功能。

