Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » Trying to change a theme

Discuss SilverStripe Themes.

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

Page: 1 2
Go to End
Author Topic: 2304 Views
  • Semazen
    Avatar
    Community Member
    11 Posts

    Trying to change a theme Link to this post

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

    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?

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Trying to change a theme Link to this post

    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.

  • Semazen
    Avatar
    Community Member
    11 Posts

    Re: Trying to change a theme Link to this post

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

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Trying to change a theme Link to this post

    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.

  • Semazen
    Avatar
    Community Member
    11 Posts

    Re: Trying to change a theme Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Trying to change a theme Link to this post

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

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

  • Semazen
    Avatar
    Community Member
    11 Posts

    Re: Trying to change a theme Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Trying to change a theme Link to this post

    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

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