留言板

Make a web content display portlet aware of its structure/template

thumbnail
Javeed Chida,修改在8 年前。

Make a web content display portlet aware of its structure/template

New Member 帖子: 8 加入日期: 14-10-23 最近的帖子
I am not sure if there is a way to accomplish this. If there isn't, I'm considering posting this under Suggestions/Feature Requests, so feel free to critique/dissuade as well if you see anything problematic with it.

Is there a way to setup a Page Template with a Web Content Display portlet on it that is (somehow) aware of its structure and template. The idea is that when a user adds a page using that template, they would simply have to click Add Content, and the structure (and template) would be pre-selected for them. In effect they would just have to enter relevant content.

Asked another way: Can a Web Content Display Portlet be configured with a structure and template specified for its content? Again, I don't see a way to accomplish this in the Web Content Display Portlet's configuration, so really looking for a technique or practice that might help do this.

Thanks.
thumbnail
Andrew Jardine,修改在8 年前。

RE: Make a web content display portlet aware of its structure/template

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
Hi Javeed,

As far as I know you can't do this. I think most people would opt for an Asset Publisher for that kind of tuning, but if you are still looking to manually select an item, that may or may not work for you. One option you can consider would be to create a JSP hook that alters the configuration screen for the Web Content Display portlet, alowing you to specify the structure you want to "filter on". I can see in the jsps that it does take into consideration the "type" .. so perhaps it is as simple as asking the user to choose a type and then passing that parameter to the search. In fact, the type is already passed (as you can see here)


	<liferay-ui:search-form page="/html/portlet/journal/article_search.jsp" searchcontainer="<%= searchContainer %>">
		<liferay-ui:param name="groupId" value="<%= String.valueOf(groupId) %>" />
		<liferay-ui:param name="type" value="<%= HtmlUtil.escape(type) %>" />
	</liferay-ui:search-form>


and the value you can see is pulled at the top of the jsp in a scriplet


String type = ParamUtil.getString(request, "type", defaultType);


So maybe you could try grabbing the type from the portlet preferences, and if the value is null, fall back to the logic above.
thumbnail
Javeed Chida,修改在8 年前。

RE: Make a web content display portlet aware of its structure/template

New Member 帖子: 8 加入日期: 14-10-23 最近的帖子
Awesome! Thanks, Andrew. This is just what I was looking for.