Page 1 of 1

[solved] Template Switcher url/page=templatename

Posted: Wed May 01, 2013 9:43 pm
by carasmo
Anything like this for the latest v. of CMSMS?

Re: Template Switcher url/page=templatename

Posted: Wed May 01, 2013 9:44 pm
by carasmo
Or a style switcher


page=nameofstylesheet

Re: Template Switcher url/page=templatename

Posted: Thu May 02, 2013 4:06 am
by chandra
Add something like this to the switch link

Code: Select all

&style=newcss
and modify your template

Code: Select all

{if $smarty.server.get.style}
  {cms_stylesheet name=$smarty.server.get.style}
{else}
  {cms_stylesheet}
{/if}

Re: Template Switcher url/page=templatename

Posted: Thu May 02, 2013 4:25 am
by carasmo
Thanks! I don't follow this since it's not really explicit (not a programmer) but I found a small javascript solution where I append the url:

Code: Select all

<!--Load Style Sheet based on appended url add url-->		

//http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
if(window.location.href.indexOf('?layout=test') > -1) {
    var fileref=document.createElement("link");
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", "assets/css/newstyle.css");
    document.getElementsByTagName("head")[0].appendChild(fileref);
    
$(document).ready(function() {
$('a').click(function(){
  if( !this.search ) this.search = '?layout=test';
});
   }); 
} //if layout=test


Re: [solved] Template Switcher url/page=templatename

Posted: Thu May 02, 2013 5:21 am
by Rolf

Code: Select all

 {cms_stylesheet name=$page_alias}