フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Saurabh Gupta
How to set default template for web content?
2013/02/04 21:54
答え

Saurabh Gupta

ランク: New Member

投稿: 23

参加年月日: 2012/09/24

最近の投稿

Is there any way to set a default template for web content articles?

As such, when posting new web content in control panel, content administrators no need to select a template by default.

This can simple the process since less click and less page refreshes involved. Also it will help the adoption rate of those content administrator who are not so IT savvy. 'Structure' and 'Template' may be a little bit too technical for them. Simple is perfect!

I noticed there are parameters in the url can be used to set the default template:
1&_15_structureId=11149&_15_templateId=11151

and one more question, i created the Page Template for page and in this page template Web Content Display protlet is there and i add a new page with this Page template then i need to check from which Page Template this page is created. How can i do this programatically?
Oliver Bayer
RE: How to set default template for web content?
2013/02/05 2:10
答え

Oliver Bayer

ランク: Liferay Master

投稿: 867

参加年月日: 2009/02/18

最近の投稿

Hi Saurabh,

afaik you can achieve it only by coding it yourself. But the good news is: it shouldn't be that hard ;).

Create a jsp hook to override a jsp from "html \ portlet \ journal \" (my guess would be edit_article.jsp). Use JournalTemplateLocalServiceUtil methods to retrieve the template you want to select (maybe by using the template name and the template groupid or 0 for a global template). Now you can use the journal template object to retrieve the linked journal structure id. Set these two values (template id, structure id) programatically ONLY if the request doesn't contain them already (otherwise you would not be able to switch to another template anymore emoticon).

HTH Oli
Saurabh Gupta
RE: How to set default template for web content?
2013/02/05 4:49
答え

Saurabh Gupta

ランク: New Member

投稿: 23

参加年月日: 2012/09/24

最近の投稿

Oliver Bayer:
Hi Saurabh,

afaik you can achieve it only by coding it yourself. But the good news is: it shouldn't be that hard ;).

Create a jsp hook to override a jsp from "html \ portlet \ journal \" (my guess would be edit_article.jsp). Use JournalTemplateLocalServiceUtil methods to retrieve the template you want to select (maybe by using the template name and the template groupid or 0 for a global template). Now you can use the journal template object to retrieve the linked journal structure id. Set these two values (template id, structure id) programatically ONLY if the request doesn't contain them already (otherwise you would not be able to switch to another template anymore emoticon).

HTH Oli


Oliver Thank you for helping me

one more Question, i have created 3 page Template and when add the new Page then i am selecting the Page Template . in this Page Template, Web Content Display Portlet is there and according to Page Template i need to set the structure and template for Web Content Display. This will be very useful to user who need to create page with one Page Template and in this Page Template which have Web Content Display will get structure and template automatically according to Page Template. so user no need to set Structure and Template manually.
Oliver Bayer
RE: How to set default template for web content?
2013/02/06 1:07
答え

Oliver Bayer

ランク: Liferay Master

投稿: 867

参加年月日: 2009/02/18

最近の投稿

Hi Saurubh,

I've never used or modified page templates before but the sources seem to be located in "html \ portlet \ layout_prototypes". But I don't think you have to change sth. there. If you select your page template you will get a blank/ empty web content display portlet right? So if a user clicks on "add new web content" the changes of the mentioned hook should apply and the default template/ structure (selected by e.g. name and group) should be set automatically. If it's not what you're looking for or if you find another solution please let me know.

Greets Oli
Saurabh Gupta
RE: How to set default template for web content?
2013/02/06 6:26
答え

Saurabh Gupta

ランク: New Member

投稿: 23

参加年月日: 2012/09/24

最近の投稿

Thank you for reply
yes, you are correct i need this thing but the problem is that i need to change the structure and template according to Page Template.
Oliver Bayer
RE: How to set default template for web content?
2013/02/07 1:31
答え

Oliver Bayer

ランク: Liferay Master

投稿: 867

参加年月日: 2009/02/18

最近の投稿

Hi,

ah ok, now I understand your requirement.

Maybe you can retrieve the page template by using:
1String pageTemplateUuid = layout.getLayoutPrototypeUuid()

Oli
Saurabh Gupta
RE: How to set default template for web content?
2013/02/11 22:51
答え

Saurabh Gupta

ランク: New Member

投稿: 23

参加年月日: 2012/09/24

最近の投稿

@Oliver Thank you very much