Page 1 of 1

know how to change the template of a page on the fly?

Posted: Mon Nov 11, 2019 6:33 pm
by archeo
Hello,

I would like to use two different templates for the same page depending on where on the site the page is called. I did not find any matching parameters in the internal link tag.

If you have a link or a piece of code thank you in advance.

Re: know how to change the template of a page on the fly?

Posted: Mon Nov 11, 2019 6:59 pm
by DIGI3
One method would be to have the page template just be something like:

Code: Select all

{if $smarty.server.HTTP_HOST == 'foo'}
  {include file='cms_template:template1}
{else}
  {include file='cms_template:template2}
{/if}
I don't know if there's a core method for actually switching the page template before it's loaded though. Would probably need a module.