[solved] Template Switcher url/page=templatename

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm

[solved] Template Switcher url/page=templatename

Post by carasmo »

Anything like this for the latest v. of CMSMS?
Last edited by carasmo on Thu May 02, 2013 4:25 am, edited 1 time in total.
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm

Re: Template Switcher url/page=templatename

Post by carasmo »

Or a style switcher


page=nameofstylesheet
chandra

Re: Template Switcher url/page=templatename

Post 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}
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm

Re: Template Switcher url/page=templatename

Post 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

User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

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

Post by Rolf »

Code: Select all

 {cms_stylesheet name=$page_alias} 
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “The Lounge”