Fórumok

How to set default template for web content?

Saurabh Gupta, módosítva 11 év-val korábban

How to set default template for web content?

New Member Bejegyzések: 23 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to set default template for web content?

Liferay Master Bejegyzések: 894 Csatlakozás dátuma: 2009.02.18. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to set default template for web content?

New Member Bejegyzések: 23 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to set default template for web content?

Liferay Master Bejegyzések: 894 Csatlakozás dátuma: 2009.02.18. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to set default template for web content?

New Member Bejegyzések: 23 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to set default template for web content?

Liferay Master Bejegyzések: 894 Csatlakozás dátuma: 2009.02.18. Legújabb bejegyzések
Hi,

ah ok, now I understand your requirement.

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

Oli
Saurabh Gupta, módosítva 11 év-val korábban

RE: How to set default template for web content?

New Member Bejegyzések: 23 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
@Oliver Thank you very much