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.

Themes /

Discuss SilverStripe Themes.

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

Trying to change a theme


Go to End
Reply


14 Posts   2625 Views

Avatar
Semazen

Community Member, 11 Posts

12 May 2010 at 1:41pm

Edited: 12/05/2010 1:42pm

I am trying to change a theme, to say any one of these [url]=http://www.theme4.com/free-silverstripe-themes.html]http://www.theme4.com/free-silverstripe-themes.html[/url] ?

I tried this and broke the site!

1) Uploaded new theme folders to /themes/
2) Changed SSViewer::set_theme('paddygreen'); in /mysite/_config.php

<?php

global $project;
$project = 'mysite';

global $database;
$database = "";

require_once("conf/ConfigureFromEnv.php");

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('paddygreen');

?>

Got error message: Fatal error: SS_ENVIRONMENT_TYPE must be defined in your _ss_environment.php. See http://doc.silverstripe.com/doku.php?id=environment-management for more infomration in /home/useraccount/public_html/cms/sapphire/conf/ConfigureFromEnv.php on line 51

3) Changed _ss_environment.php file in root to:

<?php
define('TEMP_FOLDER', '/home/useraccount/public_html/cms/tmp');

/* Database connection */
define('SS_DATABASE_SERVER', 'localhost');
define('SS_DATABASE_USERNAME', 'apcdev_silver');
define('SS_DATABASE_PASSWORD', 'mypassword');
?>

kept getting same error.

4) Removed _ss_environment.php from root and F5

root resolved to /install.php (which has of course been removed) and returned a "Problem loading page" error. Doh!

Is there an easy way to change templates?

Avatar
ajshort

Community Member, 244 Posts

12 May 2010 at 2:52pm

You need to define a database name in your _config.php file. Also, with the environment file error, you didn't actually address the constant that was undefined.

Avatar
Semazen

Community Member, 11 Posts

12 May 2010 at 4:46pm

Thanks. But do you mean that:

a) SS_DATABASE_SERVER means database NAME, or that
b) I should add an extra line of code such as:

define('SS_DATABASE_NAME', 'apcdata_silver');

Avatar
ajshort

Community Member, 244 Posts

12 May 2010 at 4:52pm

To fix the environment error you needed to add "define('SS_ENVIRONMENT_TYPE', 'dev/test/live');" to your environment file. The reason you keep getting redirected to install.php is because you haven't set the database name in your _config.php file to anything.

global $database;
$database = "";

Needs to have a database name. Alternatively, you can define SS_DATABASE_CHOOSE_NAME to have SilverStripe automatically generate a database name from your project name and some other information.

Avatar
Semazen

Community Member, 11 Posts

12 May 2010 at 5:05pm

Thanks Andrew

Did that, but unfortunately there are yet more errors:

* Director::set_environment_type(dev/test/live)
Line 56 of ConfigureFromEnv.php
* require_once(/home/useraccount/public_html/cms/sapphire/conf/ConfigureFromEnv.php)
Line 9 of _config.php
* require_once(/home/useraccount/public_html/cms/mysite/_config.php)
Line 5771 of manifest-main
* require_once(/home/useraccount/public_html/cms/tmp/manifest-main)
Line 70 of ManifestBuilder.php
* ManifestBuilder::include_manifest()
Line 150 of Core.php
* require_once(/home/useraccount/public_html/cms/sapphire/core/Core.php)
Line 61 of main.php

Warning: Director::set_environment_type passed 'dev/test/live'. It should be passed dev, test, or live in /home/useraccount/public_html/cms/03/sapphire/core/control/Director.php on line 712

Seems a lot of trouble just to change a template. Are the modules like this as well?

Avatar
Willr

Forum Moderator, 5513 Posts

12 May 2010 at 8:09pm

It takes 1 of dev, test or live, not all 3 at the same time :D.

For example define('SS_ENVIRONMENT_TYPE', 'dev'); defined a development environment.

Avatar
Semazen

Community Member, 11 Posts

12 May 2010 at 8:43pm

Thanks Willr. Spotted that a while after, and changed it to "live".

Still not having much fun though. New Error from the script says:

Website Error
There has been an error

The website server has not been able to respond to your request.

It's a shame as a few of my coders suggested SilverStripe as a CMS we could use. It's just so much trouble just to change a template.

Thanks all the same.

Avatar
Willr

Forum Moderator, 5513 Posts

12 May 2010 at 8:44pm

You should change it to dev in this case so you can see the actual error message instead of this generic one. Its probably something very simple :D

Go to Top