![]() |
CSS / skin swap in 4.3
I need to have an option in the admin to select what CSS file the skin should use - ie, main.css, main_blue.css, main_red.css. Basically just changing some link & highlight colours for the entire site depending on the seasons.
I've noticed there is a Skin Swap mod though this is perhaps too cumbersome for my needs, and doesn't seem to support 4.3. Any advice how to approach this? |
Re: CSS / skin swap in 4.3
well, you could just make 3 different style sheets, then change which style sheet is called, when you want to.
or you could make different skins altogether and upload them. Name them skin1_summer, skin1_christmas... etc. Then when you are ready name skin1 skin1_OG and name skin1_christmas skin1... then run cleanup.php. |
Re: CSS / skin swap in 4.3
True, it'd be easy for me to change the filename of the css, or edit the TPL file, but this for the owner/client to manage. Didn't realise X-Cart didn't have a simple way for a user to swap themes until this week, and now too far into the project.
Logically I can see how it could be done, though just don't have the php/smarty skills to do so: An extra "Select Main CSS file" drop down field in the admin-> option saved in the DB -> if/else statements in tpl to load the correct CSS file. |
Re: CSS / skin swap in 4.3
Run the following SQL patch:
Code:
INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`) VALUES ('css_theme', 'CSS Theme', 'Default', 'Appearance', '0', 'selector', 'Default', 'Default:default\nBlue:Blue\nRed:Red\n'); Open skin1/customer/service_css.tpl FIND: Code:
<link rel="stylesheet" type="text/css" href="{$SkinDir}/{#CSSFilePrefix#}.css" /> CHANGE TO: Code:
<link rel="stylesheet" type="text/css" href="{$SkinDir}/{#CSSFilePrefix#}{if $config.Appearance.css_theme ne 'default'}_{$config.Appearance.css_theme}{/if}.css" /> Then name your css files: main.css main_blue.css main_red.css |
Re: CSS / skin swap in 4.3
Jon - thank you so much for this!
This worked absolutely perfectly - also a really great tip for other x-cart designers/developers out there. |
All times are GMT -8. The time now is 02:36 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.