Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

custom.css Question ( theme switching )

422422 MVP
edited May 2012 in Vanilla 2.0 - 2.8

I have created a theme switcher.

Obviously it uses different css files, so lets say :

default is custom.css

We can trigger alternative themes, but need to append the new css file to the current page. Thats all done BUT !

They are named:

apple.css
grape.css
pear.css

My question is: will vanilla tolerate custom.css being replaced by apple.css in the dom.
The switcher works perfectly and has cookies built in, so users can switch willy nilly across themes.

But wondering if its a goer with Vanilla.

If it is, I will deploy on a live test forum, this is for an upcoming commercial theme.

There was an error rendering this rich post.

Answers

  • So on further investigation, seemingly. Unless the custom theme file custom.css is so named, it cannot be called anything else.

    So will try PLAN B

    There was an error rendering this rich post.

  • peregrineperegrine MVP
    edited May 2012
    can't you just 
        $Sender->AddJsFile(
        or
        $Sender->RemoveJsFile(  // assuming there is a remove.
    

    if this works - do I get a copy of your themeswitcher :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • If you want I can send you demo zip on plain html demonstration. If you can get it working, your more than welcome.

    There was an error rendering this rich post.

  • i meant css  e.g.
    
    $Sender->AddCssFile('plugins/GettingStarted/style.css');
    
    RemoveCssFile($FileName)
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Dd you get link i sent?

    There was an error rendering this rich post.

  • yep, I'll see what I can do.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Cheers :)

    There was an error rendering this rich post.

  • an idea...

    use a very lightly loaded custom.css in your theme (just the stuff that would be common across the users), then load the by-user theming css file via plugin.

  • I think thats what peregrine is gonna try and do.

    There was an error rendering this rich post.

  • 422 said:
    I think thats what peregrine is gonna try and do.

    cool. should be an interesting project. i think the UI for the users to select the theme will be the hardest part. other than that loading some css based on some info you store in the user table should be a breeze.

  • 422422 MVP
    edited May 2012

    The ui is all done and works.

    There was an error rendering this rich post.

  • peregrineperegrine MVP
    edited May 2012

    @422

    You should have received it. I just sent you a zip to work as a plugin. Good luck and happy premium sales.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Cheers will check it out asap.

    There was an error rendering this rich post.

  • SheilaSheila ✭✭

    422 said:
    I have created a theme switcher.

    Hi!

    @422, Is this addon available for download?

  • @Sheila

    I use a code snippet I got from Dynamic Drive to switch stylesheets on my forum which stores cookies to remember user choice.

  • SheilaSheila ✭✭

    Thanks! Will test that. Thou the need to switch theme is for making a new theme for my board with out stressing users while it happens, so I might need more that just a ability to switch the css.

    Naturally I could clone my board to new fresh installation but..

  • @Sheila

    I have a local copy of my forum, but I also cloned my Vanilla folder on my webserver, which I use to test changes.

    It still links to your original DB - just clear the ini files from the cache folder.

  • SheilaSheila ✭✭

    Ooh, thanks!

Sign In or Register to comment.