留言板

Portlet markup

Steven Birr,修改在10 年前。

Portlet markup

New Member 帖子: 18 加入日期: 14-1-22 最近的帖子
Hello,

is it possible to change the Liferay's generated Portlet markup code in an easy way (hook or something else)?
In a frontend developer's view it's a bit frustrating to see all the DIVs around the portlet content as you can see in the attached image... As you can see, there is a lot of markup around the footer portlet which makes it very hard to style multiple portlets on Liferay sites.
Could please anyone show me a detailed way which file(s) has to be changed to prevent the markup?

Regards,
Steven
thumbnail
David H Nebinger,修改在10 年前。

RE: Portlet markup

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
There's a bunch of things in play in a general page...

First there's the theme. The theme plays a big role in the outer page markup and is responsible for the outer frame area.

Then there's the layout which is rendered within the theme in the content area to control portlet layout.

Finally there's the portlet itself. There's outer markup that manages the portlet title, the various editor pieces, etc.

And then you get to your actual content area.

The key to styling these is to stick to the class attributes. Your portlet should have a class assigned and your internal styling will use that class as the key to manage nested element styling.

You don't want to worry about the outer divs as they are managed (styled) by the theme.
Steven Birr,修改在10 年前。

RE: Portlet markup

New Member 帖子: 18 加入日期: 14-1-22 最近的帖子
Thank's a lot David!

I know, there are themes and layouts and I am using them already. Currently, I use an "unstyled" theme and an empty layout. Thus, the generated markup is shorter than the default one. But I would also like to limit the portlet markup starting with the "portlet-dropzone" div. But if I understand it correctly, I have to edit Liferay's internal JSPs such as tomcat/webapps/ROOT/html/common/themes/portlet.jsp therefore, right?
thumbnail
David H Nebinger,修改在10 年前。

RE: Portlet markup (答复)

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
You'd have to do a JSP hook to apply an override, but yes...

Note however that some of the functionality of the portal depends upon the divs, classes and the javascript. If you start stripping them out, eventually you'll get to a point that you're also stripping out functionality.

Note that unstyled theme != unstructured theme. Even unstyled still has the divs (with the classes) in the templates, and portlet.vm also has structural content too.