Does anyone know how to use the styleswitcher Module, doc. is very lacking?
Help for the StylesheetSwitcher module
What does this module do?
It provides an interface for users to switch stylesheets. The stylesheets it uses are the selection of additive stylesheets that are located under Content > stylesheets.
How should I use it?
There are two ways to integrate this page into the front end, both represent themselves as standard tags, so you use {cms_module module="stylesheetswitcher"} with any of the arguments below.
What parameters are there?
There are a couple of tunable parameters:
* use_javascript [true|false] Set this styleswitcher to use AJAX in compliant browsers. not implemented yet
* format [selector|summary|summary_link|link] This can have three valid values: 'selector' will display a page content that allows a user to select a selection of page styles (ie more than one). 'summary' displays a smaller drop down that is suitable for inline display ('summary_link' displays the same drop down with a link to a copy of the output from 'selector'). 'link' provides a link to a page containing 'selector'
Parameters
* (optional) lang="en_US" - Parameter is used to specify what language to use for display on the frontend. Not all modules support or need this.
is this,,
format [selector|summary|summary_link|link]
like this,,
cms_module module="stylesheetswitcher" format="summary"}
have no luck using it,
mark
Style Switcher
Re: Style Switcher
To be honest I don't use CMS's style sheets but use my own style sheets and style sheet switcher tags and selector tags?
http://www.cms.shoesforindustry.net/
So the answer is no...
Russ
http://www.cms.shoesforindustry.net/
So the answer is no...
Russ
Re: Style Switcher
i saw your site and was hoping it was ours,, 
oh well so much for having less pages @ http://www.multiintech.com/
thanks
mark

oh well so much for having less pages @ http://www.multiintech.com/
thanks
mark
Re: Style Switcher
nobody else has tried the style switcher or gotten it to work?
already did search.....
mark

mark
Re: Style Switcher
I think it's an issue with the new stylesheet.php code. Try setting the old_stylesheet to true in config.php.
Re: Style Switcher
got it to work, but i would rather switch templates tried to change the .php but the stylesheets are called 2 ways css and style,
$prefix.
this is what i have so far... not sure how to call the templates... tried tpl and template
What does this module do?
It provides an interface for users to switch templates. The templates it uses are the selection of additive templates that are located under Content > templates.
How should I use it?
There are two ways to integrate this page into the front end, both represent themselves as standard tags, so you use {cms_module module=\"templateswitcher\"} with any of the arguments below.
What parameters are there?
There are a couple of tunable parameters:
use_javascript [true|false] Set this templateswitcher to use AJAX in compliant browsers. not implemented yet
format [selector|summary|summary_link|link] This can have three valid values: 'selector' will display a page content that allows a user to select a selection of page templates (ie more than one). 'summary' displays a smaller drop down that is suitable for inline display ('summary_link' displays the same drop down with a link to a copy of the output from 'selector'). 'link' provides a link to a page containing 'selector'
";
}
function GetChangeLog()
{
?>
Author: Thomas Williams tom@webrocketdesign.com
Please send all bug requests through coding@webrocketdesign.com
Change History:
Version 0.1
Initial Release 15/11/05
get_template();
if(strlen($template) > 0)
{
$tpl = $this->cms->db->Execute("SELECT template_text FROM ".cms_db_prefix()."tpl WHERE template_id IN (".str_replace('&',',',$template).")");
if ($tpl && $tpl->RowCount() > 0)
{
while($row = $tpl->FetchRow())
$template .= $row['template_text'];
}
elseif(strcmp($template,'__notemplate') == 0)//Remove all template.
{
$template = '';
}
}
return $template;
}
function DoAction($action, $id, $params, $return_id = '')
{
if(strcmp($action,'switch') == 0)
{
$template = $this->get_template($id);
if(strlen($template) > 0)//No style has been passed, remove any cookie
{
setcookie('template',$template,strtotime('+10 years'));
}
else
{
setcookie('template','',time() - 3600);
}
}
$use_javascript = isset($params['use_javascript']) ? strcmp($params['use_javascript'],'true') == 0 : true;
if(isset($params['format']))
{
switch($params['format'])
{
case 'summary' : $this->draw_summary($id,$return_id,$use_javascript,false);//No link
break;
case 'summary-link': $this->draw_summary($id,$return_id,$use_javascript,true);//Show link
break;
case 'link' : echo $this->CreateLink($id, 'selector', $return_id, (isset($params['text']) ? $params['text'] : 'Select Template'));
break;
case 'selector' : $this->draw_selector($id,$return_id,$use_javascript);
break;
}
}
else//By default draw the selector
{
$this->draw_selector($id,$return_id,$use_javascript,(isset($params['notemplate']) ? strcmp($params['notemplate'],'true') == 0 : true));
}
}
/**NOT IN API**
* Draw a inline element that can display a list of the appropriate elements
*/
function draw_summary($id,$return_id,$use_javascript,$display_link = false)
{
$template = $this->get_template($id);
$templates = $this->cms->db->Execute("SELECT template_id, template_name FROM ".cms_db_prefix()."tpl");
if($templates && $templates->RowCount() > 0)
{
$options = array();
$index = -1;
while($row = $templates->FetchRow())
{
$options[$row['template_name']] = $row['template_id'];
if(strcmp($row['template_id'],$template) == 0)
{
$index = count($options) - 1;
}
}
//Extra options for special circumstances.
$options['Default template'] = '__notemplate';
$index = strcmp($template,'') == 0 ? count($options) - 1 : $index;
if($index == -1 && strlen($template) > 0)
{
$options['Custom'] = $template;
$index = count($options) - 1;
}
echo $this->CreateFormStart($id,'switch',$return_id,'post','',true);
echo "";
echo $this->CreateInputHidden($id, 'prefix', $id, 'id="template-prefix"');
echo $this->CreateInputDropdown($id,'template',$options,$index);
echo $this->CreateInputSubmit($id,'save','Switch');
echo "
";
if($display_link)
{
echo $this->CreateLink($id, 'selector', $return_id, 'Advanced controls');
}
echo "";
echo $this->CreateFormEnd();
}
}
/**NOT IN API**
* Draw a element selection page
*/
function draw_selector($id,$return_id,$use_javascript)
{
$template = $this->get_template($id);
$template_arr = explode('&',$template);
$checked = false;
$templates = $this->cms->db->Execute("SELECT * FROM ".cms_db_prefix()."tpl");
if($templates && $templates->RowCount() > 0)
{
$options = array();
while($row = $templates->FetchRow())
{
$template = array('id' => $row['template_id'], 'value' => $row['template_id'],'label' => $row['template_name']);
if(strcmp($row['template_id'],$template) == 0)//An exact match
{
$template['checked'] = 'checked';
$checked = true;
}
elseif(!$checked && in_array($row['template_id'],$template_arr))
{
$template['checked'] = 'possible';
}
$template_arr = array_diff($template_arr,array($row['template_id']));
array_push($options,$template);
}
//Now stick in the no template options
$notpl = array('id' => 'notpl','label' => 'Default Template', 'value' => '__notpl');
if(strcmp('',$template) == 0)//No style is where we're at.
{
$notpl['checked'] = 'checked';
$checked = true;
$template_arr = array();
}
array_push($options,$notpl);
if($checked)//We have found an exact match, remove any possibles.
{
$remove_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) unset($entry["checked"]);');
array_walk($options,$remove_possibles);
}
if(!$checked && count($template_arr) == 0)//We have found a set that matches exactly. Switch possibles to checked.
{
$confirm_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) $entry["checked"] = "checked";');
array_walk($options,$confirm_possibles);
}
elseif(count($template_arr) > 0 AND strlen($template) > 0)//They have somehow managed to set a unique combination, add a custom option.
{
$remove_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) unset($entry["checked"]);');
array_walk($options,$remove_possibles);
array_push($options,array('id' => 'custom', 'label' => 'Custom template', 'value' => $template, 'checked' => 'checked'));
}
echo "Select the templates that you want to use";
echo "Choose from the following list of templates and check the ones you want. For example, If you want extra large fonts and high contrast display, check both.";
echo $this->CreateFormStart($id,'switch',$return_id,'post');
echo "";
echo $this->CreateInputHidden($id, 'prefix', $id, 'id="template-prefix"');
foreach ($options as $row)
{
echo $this->CreateInputCheckbox($id, 'template[]', $row['value'], (isset($row['checked']) && strcmp($row['checked'],'checked') == 0 ? $row['value'] : null), 'id="template-'.$row['id'].'"');
echo ''.$row['label'].'';
echo "
";
}
echo "";
echo "";
if($use_javascript)
{
echo "";
}
echo $this->CreateInputSubmit($id,'save','Save Changes','id="template-submit"');
echo "";
echo $this->CreateFormEnd();
}
}
/**NOT IN API**
* Get the template
*/
function get_template($prefix = '')
{
$value = null;
if(isset($_GET[$prefix.'temp']))
$value = $_GET[$prefix.'temp'];
elseif(isset($_POST[$prefix.'temp']))
$value = $_POST[$prefix.'temp'];
if(!is_null($value))
{
if(is_array($value))
$value = implode('&',$value);
if(strpos($value,'__notpl') === false)
return $value;
}
elseif(isset($_COOKIE['template']))
{
return trim($_COOKIE['template']);
}
return '';
}
}
?>
mark
the know nothin bout PHP guy
EDIT: BTW this does install like the other but as Template Switcher...
$prefix.
this is what i have so far... not sure how to call the templates... tried tpl and template
What does this module do?
It provides an interface for users to switch templates. The templates it uses are the selection of additive templates that are located under Content > templates.
How should I use it?
There are two ways to integrate this page into the front end, both represent themselves as standard tags, so you use {cms_module module=\"templateswitcher\"} with any of the arguments below.
What parameters are there?
There are a couple of tunable parameters:
use_javascript [true|false] Set this templateswitcher to use AJAX in compliant browsers. not implemented yet
format [selector|summary|summary_link|link] This can have three valid values: 'selector' will display a page content that allows a user to select a selection of page templates (ie more than one). 'summary' displays a smaller drop down that is suitable for inline display ('summary_link' displays the same drop down with a link to a copy of the output from 'selector'). 'link' provides a link to a page containing 'selector'
";
}
function GetChangeLog()
{
?>
Author: Thomas Williams tom@webrocketdesign.com
Please send all bug requests through coding@webrocketdesign.com
Change History:
Version 0.1
Initial Release 15/11/05
get_template();
if(strlen($template) > 0)
{
$tpl = $this->cms->db->Execute("SELECT template_text FROM ".cms_db_prefix()."tpl WHERE template_id IN (".str_replace('&',',',$template).")");
if ($tpl && $tpl->RowCount() > 0)
{
while($row = $tpl->FetchRow())
$template .= $row['template_text'];
}
elseif(strcmp($template,'__notemplate') == 0)//Remove all template.
{
$template = '';
}
}
return $template;
}
function DoAction($action, $id, $params, $return_id = '')
{
if(strcmp($action,'switch') == 0)
{
$template = $this->get_template($id);
if(strlen($template) > 0)//No style has been passed, remove any cookie
{
setcookie('template',$template,strtotime('+10 years'));
}
else
{
setcookie('template','',time() - 3600);
}
}
$use_javascript = isset($params['use_javascript']) ? strcmp($params['use_javascript'],'true') == 0 : true;
if(isset($params['format']))
{
switch($params['format'])
{
case 'summary' : $this->draw_summary($id,$return_id,$use_javascript,false);//No link
break;
case 'summary-link': $this->draw_summary($id,$return_id,$use_javascript,true);//Show link
break;
case 'link' : echo $this->CreateLink($id, 'selector', $return_id, (isset($params['text']) ? $params['text'] : 'Select Template'));
break;
case 'selector' : $this->draw_selector($id,$return_id,$use_javascript);
break;
}
}
else//By default draw the selector
{
$this->draw_selector($id,$return_id,$use_javascript,(isset($params['notemplate']) ? strcmp($params['notemplate'],'true') == 0 : true));
}
}
/**NOT IN API**
* Draw a inline element that can display a list of the appropriate elements
*/
function draw_summary($id,$return_id,$use_javascript,$display_link = false)
{
$template = $this->get_template($id);
$templates = $this->cms->db->Execute("SELECT template_id, template_name FROM ".cms_db_prefix()."tpl");
if($templates && $templates->RowCount() > 0)
{
$options = array();
$index = -1;
while($row = $templates->FetchRow())
{
$options[$row['template_name']] = $row['template_id'];
if(strcmp($row['template_id'],$template) == 0)
{
$index = count($options) - 1;
}
}
//Extra options for special circumstances.
$options['Default template'] = '__notemplate';
$index = strcmp($template,'') == 0 ? count($options) - 1 : $index;
if($index == -1 && strlen($template) > 0)
{
$options['Custom'] = $template;
$index = count($options) - 1;
}
echo $this->CreateFormStart($id,'switch',$return_id,'post','',true);
echo "";
echo $this->CreateInputHidden($id, 'prefix', $id, 'id="template-prefix"');
echo $this->CreateInputDropdown($id,'template',$options,$index);
echo $this->CreateInputSubmit($id,'save','Switch');
echo "
";
if($display_link)
{
echo $this->CreateLink($id, 'selector', $return_id, 'Advanced controls');
}
echo "";
echo $this->CreateFormEnd();
}
}
/**NOT IN API**
* Draw a element selection page
*/
function draw_selector($id,$return_id,$use_javascript)
{
$template = $this->get_template($id);
$template_arr = explode('&',$template);
$checked = false;
$templates = $this->cms->db->Execute("SELECT * FROM ".cms_db_prefix()."tpl");
if($templates && $templates->RowCount() > 0)
{
$options = array();
while($row = $templates->FetchRow())
{
$template = array('id' => $row['template_id'], 'value' => $row['template_id'],'label' => $row['template_name']);
if(strcmp($row['template_id'],$template) == 0)//An exact match
{
$template['checked'] = 'checked';
$checked = true;
}
elseif(!$checked && in_array($row['template_id'],$template_arr))
{
$template['checked'] = 'possible';
}
$template_arr = array_diff($template_arr,array($row['template_id']));
array_push($options,$template);
}
//Now stick in the no template options
$notpl = array('id' => 'notpl','label' => 'Default Template', 'value' => '__notpl');
if(strcmp('',$template) == 0)//No style is where we're at.
{
$notpl['checked'] = 'checked';
$checked = true;
$template_arr = array();
}
array_push($options,$notpl);
if($checked)//We have found an exact match, remove any possibles.
{
$remove_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) unset($entry["checked"]);');
array_walk($options,$remove_possibles);
}
if(!$checked && count($template_arr) == 0)//We have found a set that matches exactly. Switch possibles to checked.
{
$confirm_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) $entry["checked"] = "checked";');
array_walk($options,$confirm_possibles);
}
elseif(count($template_arr) > 0 AND strlen($template) > 0)//They have somehow managed to set a unique combination, add a custom option.
{
$remove_possibles = create_function('&$entry,$key','if(isset($entry["checked"]) && strcmp($entry["checked"],"possible") == 0) unset($entry["checked"]);');
array_walk($options,$remove_possibles);
array_push($options,array('id' => 'custom', 'label' => 'Custom template', 'value' => $template, 'checked' => 'checked'));
}
echo "Select the templates that you want to use";
echo "Choose from the following list of templates and check the ones you want. For example, If you want extra large fonts and high contrast display, check both.";
echo $this->CreateFormStart($id,'switch',$return_id,'post');
echo "";
echo $this->CreateInputHidden($id, 'prefix', $id, 'id="template-prefix"');
foreach ($options as $row)
{
echo $this->CreateInputCheckbox($id, 'template[]', $row['value'], (isset($row['checked']) && strcmp($row['checked'],'checked') == 0 ? $row['value'] : null), 'id="template-'.$row['id'].'"');
echo ''.$row['label'].'';
echo "
";
}
echo "";
echo "";
if($use_javascript)
{
echo "";
}
echo $this->CreateInputSubmit($id,'save','Save Changes','id="template-submit"');
echo "";
echo $this->CreateFormEnd();
}
}
/**NOT IN API**
* Get the template
*/
function get_template($prefix = '')
{
$value = null;
if(isset($_GET[$prefix.'temp']))
$value = $_GET[$prefix.'temp'];
elseif(isset($_POST[$prefix.'temp']))
$value = $_POST[$prefix.'temp'];
if(!is_null($value))
{
if(is_array($value))
$value = implode('&',$value);
if(strpos($value,'__notpl') === false)
return $value;
}
elseif(isset($_COOKIE['template']))
{
return trim($_COOKIE['template']);
}
return '';
}
}
?>
mark
the know nothin bout PHP guy

EDIT: BTW this does install like the other but as Template Switcher...
Last edited by Anonymous on Tue May 16, 2006 1:15 am, edited 1 time in total.