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.

Template Questions /

Can't install new theme - only the "blackcandy" - theme works well


Reply


5 Posts   1853 Views

Avatar
unkas

Community Member, 3 Posts

27 October 2009 at 2:51am

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

Avatar
Willr

Forum Moderator, 5513 Posts

27 October 2009 at 11:36am

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

Avatar
unkas

Community Member, 3 Posts

27 October 2009 at 10:09pm

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

Avatar
Willr

Forum Moderator, 5513 Posts

27 October 2009 at 10:19pm

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;

Avatar
unkas

Community Member, 3 Posts

28 October 2009 at 1:22am

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