Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Previewing themes

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 2202 Views
  • saimo
    Avatar
    Community Member
    67 Posts

    Previewing themes Link to this post

    Is it possible to preview a theme on a live site?
    For example by using an URL parameter: (site)?theme=new-theme. I need this because I really think it's to much work getting remote access to my dev server working (running devserver localy in a linux box currently).

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Previewing themes Link to this post

    well demo.silverstripe.com does this with code. You'll notice all our silverstripe.com/themes can be previewed at the demo, right?

    if(isset($_GET['theme'])) {
       $_SESSION['theme'] = $_GET['theme'];
    }

    $theme = isset($_SESSION['theme']) ? $_SESSION['theme'] : 'blackcandy';

    SSViewer::set_theme($theme);

  • ulysses
    Avatar
    Community Member
    57 Posts

    Re: Previewing themes Link to this post

    if(isset($_GET['theme'])) {
    $_SESSION['theme'] = $_GET['theme'];
    }

    $theme = isset($_SESSION['theme']) ? $_SESSION['theme'] : 'blackcandy';

    SSViewer::set_theme($theme);

    Which file do you add this code in?

  • simon_w
    Avatar
    Forum Moderator
    467 Posts

    Re: Previewing themes Link to this post

    mysite/_config.php instead of SSViewer::set_theme('blackcandy');

  • ulysses
    Avatar
    Community Member
    57 Posts

    Re: Previewing themes Link to this post

    Hey thanks. That's great works like a charm.

  • saimo
    Avatar
    Community Member
    67 Posts

    Re: Previewing themes Link to this post

    Thanks for the reply. Sorry for my absence here, I've been away.

    I'm gonna test it soon, but I have some things I need to do first. But I have no doubts that it will work, I even understand how it works:).

  • ulysses
    Avatar
    Community Member
    57 Posts

    Re: Previewing themes Link to this post

    I've got it working quite good with a family site I am building.

    You need to create a hyperlink which links to each of the themes using the code:

    ?theme=plain
    ?theme=blackcandy
    ?theme=terrafirma

    etc.

  • saimo
    Avatar
    Community Member
    67 Posts

    Re: Previewing themes Link to this post

    Yes, that would be the way to go if I wanted a multitheme site, but as it is now I only need to preview the themes.

    2202 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.