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).
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.
- Page 11(current)
- 2
- Next 10 entries
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);
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?
mysite/_config.php instead of SSViewer::set_theme('blackcandy');
Hey thanks. That's great works like a charm.
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:).
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.
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.
- Page 11(current)
- 2
- Next 10 entries