i have a problem with style_switcher that worked fine in V 1.3, but after updating to V 1.4 the switcher doesnt work properly any more.
Style_switcher i am talking about is the one from Documentatin/Share your tags
Code: Select all
if ('css_head' == $params['action']) {
if (FALSE != isset($_COOKIE['Style_Layout']) && 'small' != $_COOKIE['Style_Layout']) {
echo '<link rel="stylesheet" type="text/css" href="stylesheet.php?name='.$params['template'].'_layout_'.$_COOKIE['Style_Layout'].'" />';
}
if (FALSE != isset($_COOKIE['Style_Text']) && 'small' != $_COOKIE['Style_Text']) {
echo '<link rel="stylesheet" type="text/css" href="stylesheet.php?name='.$params['template'].'_text_'.$_COOKIE['Style_Text'].'" />';
}
}
if ('show_switcher' == $params['action']) {
echo <<<EOF
<__script__ type="text/javascript">function setLayout(size){ document.cookie = 'Style_Layout=' + escape(size) + ';expires=' + new Date('December 31, 2020 23:59:59').toGMTString() + ';path=/';location.reload();}</__script>
<span style="margin-right: 1em;">
EOF;
if (FALSE != isset($_COOKIE['Style_Layout']) && 'small' != $_COOKIE['Style_Layout']) {
echo '<a href="javascript:setLayout(\'small\')">';
}
echo '<img alt="Narrow width layout" src="uploads/images/style_switcher/icon-layout-small';
if (FALSE == isset($_COOKIE['Style_Layout']) || 'small' == $_COOKIE['Style_Layout']) {
echo '-on';
}
echo '.gif" style="height:17px;width:16px;" />';
if (FALSE != isset($_COOKIE['Style_Layout']) && 'small' != $_COOKIE['Style_Layout']) {
echo '</a>';
}
if ('medium' != $_COOKIE['Style_Layout']) {
echo '<a href="javascript:setLayout(\'medium\')">';
}
echo '<img alt="Medium width layout" src="uploads/images/style_switcher/icon-layout-medium';
if (FALSE != isset($_COOKIE['Style_Layout']) && 'medium' == $_COOKIE['Style_Layout']) {
echo '-on';
}
echo '.gif" style="height:17px;width:16px;" />';
if ('medium' != $_COOKIE['Style_Layout']) {
echo '</a>';
}
if ('large' != $_COOKIE['Style_Layout']) {
echo '<a href="javascript:setLayout(\'large\')">';
}
echo '<img alt="Large width layout" src="uploads/images/style_switcher/icon-layout-large';
if (FALSE != isset($_COOKIE['Style_Layout']) && 'large' == $_COOKIE['Style_Layout']) {
echo '-on';
}
echo '.gif" style="height:17px;width:16px;" />';
if ('large' != $_COOKIE['Style_Layout']) {
echo '</a>';
}
echo '</span>';
echo "<__script__ type=\"text/javascript\">function setText(size){ document.cookie = 'Style_Text=' + escape(size) + ';expires=' + new Date('December 31, 2020 23:59:59').toGMTString() + ';path=/';location.reload();}</__script>";
if (FALSE != isset($_COOKIE['Style_Text']) && 'small' != $_COOKIE['Style_Text']) {
echo '<a href="javascript:setText(\'small\')">';
}
echo '<img alt="Small text" src="uploads/images/style_switcher/icon-text-small';
if (FALSE == isset($_COOKIE['Style_Text']) || 'small' == $_COOKIE['Style_Text']) {
echo '-on';
}
echo '.gif" style="height:17px;width:17px;" />';
if (FALSE != isset($_COOKIE['Style_Text']) && 'small' != $_COOKIE['Style_Text']) {
echo '</a>';
}
if ('medium' != $_COOKIE['Style_Text']) {
echo '<a href="javascript:setText(\'medium\')">';
}
echo '<img alt="Medium text" src="uploads/images/style_switcher/icon-text-medium';
if (FALSE != isset($_COOKIE['Style_Text']) && 'medium' == $_COOKIE['Style_Text']) {
echo '-on';
}
echo '.gif" style="height:17px;width:17px;" />';
if ('medium' != $_COOKIE['Style_Text']) {
echo '</a>';
}
if ('large' != $_COOKIE['Style_Text']) {
echo '<a href="javascript:setText(\'large\')">';
}
echo '<img alt="Large text" src="uploads/images/style_switcher/icon-text-large';
if (FALSE != isset($_COOKIE['Style_Text']) && 'large' == $_COOKIE['Style_Text']) {
echo '-on';
}
echo '.gif" style="height:17px;width:17px;" />';
if ('large' != $_COOKIE['Style_Text']) {
echo '</a>';
}
}

The suggestion from Alby was to hack the UDT by calling the ID of the Stylesheet since the old method with Stylesheet name no longer works.
The code by Alby as following:
Code: Select all
global $gCms;
$config = &$gCms->config;
$db =& $gCms->GetDb();
$query = 'SELECT css_id FROM '.cms_db_prefix().'css WHERE css_name = ?';
$cssid = $db->GetOne( $query, array($name));
Unfortunately i am not a PHP Programmer so i have no idea how to put this together.
Anyone here to help me out?