Jump to:

3434 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Can't install new theme - only the "blackcandy" - theme works well

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

Page: 1
Go to End
Author Topic: 1793 Views
  • unkas
    Avatar
    Community Member
    3 Posts

    Can't install new theme - only the "blackcandy" - theme works well Link to this post

    I tried to install a new theme (local xampp installation) and I followed the steps below but it didn't work. The error message I got is at the end of the comment. Does anybody know what causes the problem?

    To install a new theme, follow the steps below:

    Step 1. Check the official SilverStripe website for free themes.

    Step 2. Once you find a theme you like, download it to your computer.

    Step 3. Upload the theme package to the "themes" folder inside your SilverStripe directory.

    Step 4. Extract the theme package.

    Step 5. To set the new theme, you should edit the _config.php file located in your mysite folder.

    The line you should edit is:

    SSViewer::set_theme('blackcandy');

    If, for example, you wish to install the wine theme from http://www.silverstripe.org/themes, after you upload and extract the theme package to the "themes" folder, you should open mysite/_config.php and change:

    SSViewer::set_theme('blackcandy');

    to

    SSViewer::set_theme('wine');

    Error message:

    [Warning] file_get_contents() [function.file-get-contents]: Filename cannot be empty
    GET /silverstripe/
    Line 277 in C:\xampp\htdocs\SilverStripe\sapphire\core\SSViewer.php

    Source
    268 /**
    269 * Used by <% include Identifier %> statements to get the full
    270 * unparsed content of a template file.
    271 *
    272 * @uses getTemplateFile()
    273 * @param string $identifier A template name without '.ss' extension or path.
    274 * @return string content of template
    275 */
    276 public static function getTemplateContent($identifier) {
    277 return file_get_contents(SSViewer::getTemplateFile($identifier));
    278 }
    279
    280 /**
    281 * @ignore
    282 */
    283 static private $flushed = false;
    Trace
    file_get_contents()
    Line 277 of SSViewer.php
    SSViewer::getTemplateContent(Breadcrumbs)
    Line 2 of SSViewer.php(396) : runtime-created function
    __lambda_func(Array)

    preg_replace_callback(/<% include +([A-Za-z0-9_]+) +%>/,lambda_31,<!-- template C:/xampp/htdocs/SilverStripe/themes/wine/templates/Layout/Page.ss --> <div id="Content-Container"> <div id="Breadcrumbs"> <% include Breadcrumbs %> </div> <h2>$Title</h2> $Content $Form $PageComments </div> <div id="Sidebar"> <% if Menu(2) %> <% include SideBar %> <% end_if %> </div> <!-- end template C:/xampp/htdocs/SilverStripe/themes/wine/templates/Layout/Page.ss -->)
    Line 396 of SSViewer.php
    SSViewer::parseTemplateContent(<div id="Content-Container"> <div id="Breadcrumbs"> <% include Breadcrumbs %> </div> <h2>$Title</h2> $Content $Form $PageComments </div> <div id="Sidebar"> <% if Menu(2) %> <% include SideBar %> <% end_if %> </div> ,C:/xampp/htdocs/SilverStripe/themes/wine/templates/Layout/Page.ss)
    Line 321 of SSViewer.php
    SSViewer->process(Page_Controller)
    Line 346 of SSViewer.php
    SSViewer->process(Page_Controller)
    Line 175 of Controller.php
    Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    RequestHandler->handleRequest(HTTPRequest)
    Line 122 of Controller.php
    Controller->handleRequest(HTTPRequest)
    Line 29 of ModelAsController.php
    ModelAsController->handleRequest(HTTPRequest)
    Line 44 of RootURLController.php
    RootURLController->handleRequest(HTTPRequest)
    Line 277 of Director.php
    Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    Director::direct(/)
    Line 118 of main.php

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Can't install new theme - only the "blackcandy" - theme works well Link to this post

    After you installed it did you flush your cache - visit the url http://www.yoursite.com?flush=1

  • unkas
    Avatar
    Community Member
    3 Posts

    Re: Can't install new theme - only the "blackcandy" - theme works well Link to this post

    Yes I did: http://localhost/silverstripe/?flush=1 but it still doesn't work. What else can I try?

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Can't install new theme - only the "blackcandy" - theme works well Link to this post

    Hmm a couple people have raised this now. Try this workaround

    in sapphire/core/SSView.php line227 change

    return file_get_contents(SSViewer::getTemplateFile($identifier));

    to

    return (SSViewer::getTemplateFile($identifier)) ? file_get_contents(SSViewer::getTemplateFile($identifier)) : false;

  • unkas
    Avatar
    Community Member
    3 Posts

    Re: Can't install new theme - only the "blackcandy" - theme works well Link to this post

    Now it's working. Thanks - but ist this a general problem with the current php - code line?

    1793 Views
Page: 1
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.