Fórumok

switch themes for a page using a parameter in URL

Philippe dreux, módosítva 15 év-val korábban

switch themes for a page using a parameter in URL

New Member Bejegyzések: 12 Csatlakozás dátuma: 2007.10.25. Legújabb bejegyzések
Hello !

I'd like to know if it's possible, in a page, to switch from one theme to another by using a parameter like :

http://.....?theme_id=mythemeid

Have you ever seen something like this ? What is the syntax of the parameter ?

the purpose is that i created a "light" theme for printing, and i would like to put a link in my pages which would point to the same URL, but with the additional parameter to specify the print theme !

Any idea ?

Thanks a lot !
thumbnail
Artur Linhart, módosítva 15 év-val korábban

RE: switch themes for a page using a parameter in URL

Expert Bejegyzések: 459 Csatlakozás dátuma: 2007.09.13. Legújabb bejegyzések
Hello,


I do not think this is simply possible... You want to display the same page in the different theme, is it true? something like to change temporary the theme of the page for the better printing... Interesting idea... But I guess You had to perform a very deep changes in the page rendering process to archieve this result... But if somebody finds the simple way, I am also interested to know it :-))

cheers, Archie
Philippe dreux, módosítva 15 év-val korábban

RE: switch themes for a page using a parameter in URL

New Member Bejegyzések: 12 Csatlakozás dátuma: 2007.10.25. Legújabb bejegyzések
Thanks for the answer !

The goal was in fact to display a unique page with 2 themes, one "standart" and one for printing. I'll have to find another way to achieve this.

For information the current (bad emoticon) solution i use to print only one article is the following :

- I create a hidden page with the theme & layout i want for printing, and 1 journal content. This page will be "shared" and used to display any article for printing. We use a friendly url like /web/guest/print

- In the template of the article, i do this link to the shared hidden page, to specify which article will be displayed in the journalcontent _56_instance_TzYE_ :


/web/guest/print?p_p_id=56_INSTANCE_TzYE&p_p_action=1&p_p_state=normal&p_p_mode=view
&_56_INSTANCE_TzYE_struts_action=%2Fjournal_content%2Fview&_56_INSTANCE_TzYE_groupId=10104
&_56_INSTANCE_TzYE_version=1.0&_56_INSTANCE_TzYE_articleId=[b]$reserved-article-id.data[/b]')



But this solution is not good, it works for 1 article, but sucks for a complete page with multiple portlets...

so i'm still searching for a good simple solution ;)
thumbnail
Ray Augé, módosítva 15 év-val korábban

RE: switch themes for a page using a parameter in URL

Liferay Legend Bejegyzések: 1197 Csatlakozás dátuma: 2005.02.08. Legújabb bejegyzések
Hey Philippe,

The theme velocity context has access to the HttpServletRequest object as $request.

This means that you can simply have you theme react to any (custom?) request parameters.

i.e. if you were to pass a &print=true to the current URL, and have your theme's templates alter their behaviour accordingly (load different css, hide images, anything else...).

You could simply add a "Print" link/button anywhere on the page:

#set ($printURL = $portalUtil.getCurrentURL($request) + "&print=true")
<a href="${printURL}">Print This Page</a>



Hope that helps!
thumbnail
Ray Augé, módosítva 15 év-val korábban

Re: [Liferay Forums][4. Custom Theme Development] RE: switch themes for a p

Liferay Legend Bejegyzések: 1197 Csatlakozás dátuma: 2005.02.08. Legújabb bejegyzések
Hey Philippe,

The theme velocity context has access to the HttpServletRequest object
as $request.

This means that you can simply have you theme react to any (custom?)
request parameters.

i.e. if you were to pass a &print=true to the current URL, and have your
theme's templates alter their behaviour accordingly (load different css,
hide images, anything else...).

You could simply add a "Print" link/button anywhere on the page:

#set ($printURL = $portalUtil.getCurrentURL($request) + "&print=true")
<a href="${printURL}">Print This Page</a>


Hope that helps!