Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Previewing themes


Go to End


9 Posts   2879 Views

Avatar
saimo

Community Member, 67 Posts

28 February 2008 at 10:01am

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).

Avatar
Sigurd

Forum Moderator, 628 Posts

29 February 2008 at 4:00pm

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);

Avatar
ulysses

Community Member, 57 Posts

2 March 2008 at 4:09am

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?

Avatar
(deleted)

Community Member, 473 Posts

2 March 2008 at 8:01am

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

Avatar
ulysses

Community Member, 57 Posts

2 March 2008 at 9:38pm

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

Avatar
saimo

Community Member, 67 Posts

6 March 2008 at 8:12am

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:).

Avatar
ulysses

Community Member, 57 Posts

6 March 2008 at 10:34am

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.

Avatar
saimo

Community Member, 67 Posts

6 March 2008 at 9:54pm

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.

Go to Top