From time to time, things will go wrong. Here’s a few things to try when you’re confused:
Putting ?flush=1 on the end of the URL will clear out all cached content; this is a pretty common solution to a lot of development problems. Here are some specifics situations:
Visiting db/build runs a script that will check the database schema and update it as necessary. Putting ?flush=1 on the end makes sure that nothing that’s linked to the old database structure will be carried over. If things aren’t saving, pages aren’t loading, or other random things aren’t working it’s possible that the database hasn’t been updated to handle the new code. Here are some specifics situations:
If you’ve changed the resize functions of your image uploaders you can run this again - and all the images will be resampled to the new arguments for the GD functions. This also, in some cases, repairs broken image links that can happen from time to time.
If you’ve set up your site and it used to be working, but now it’s suddenly totally broken, you may have forgotten to publish your draft content. Go to the CMS and use the “publish” button. You can visit admin/publishall to publish every page on the site, if that’s easier.
If you have made sure the templates have been flushed ?flush=1 you should try Ctrl + F5 to clear your browsers cache.
Please make sure all code inside *.php-files is wrapped in classes. Due to the way ManifestBuilder includes all files with this extension, any procedural code will be executed on every call. Most common error here is putting a test.php/phpinfo.php file in the document root. See datamodel and controllers for ways how to structure your code.
Example: Wrong file /<mysite>/phpinfo.php
<?php phpinfo(); // this will execute and output before any Silverstripe-code
mod_rewrite not configured correctly. The module needs to be enabled, and AllowOverride needs to be enabled for the current path
SilverStripe CMS essentialy depends on rewrites, so here is a quick fix for version 1.4.18 and later.
var.usualUrlCharClasses = "[\w\d\%\&\/\\\-\_\+\=\@\.\,\>\<\~]"
server.error-handler-404 = "/sapphire/main.php"
url.rewrite-once = (
"^([^\?\ ]*\.pdf)$" => "$1",
"^([^\?\ ]*\.swf)$" => "$1",
"^([^\?\ ]*\.gif)$" => "$1",
"^([^\?\ ]*\.jpg)$" => "$1",
"^([^\?\ ]*\.jpeg)$" => "$1",
"^([^\?\ ]*\.png)$" => "$1",
"^([^\?\ ]*\.xbm)$" => "$1",
"^([^\?\ ]*\.xpm)$" => "$1",
"^([^\?\ ]*\.css)$" => "$1",
"^([^\?\ ]*\.html)$" => "$1",
"^([^\?\ ]*\.htm)$" => "$1",
"^([^\?\ ]*\.js)$" => "$1",
"^([^\?\ ]*\.text)$" => "$1",
"^([^\?\ ]*\.txt)$" => "$1",
"^([^\?\ ]*\.dtd)$" => "$1",
"^([^\?\ ]*\.xml)$" => "$1",
"^/assets/(.*)$" => "/assets/$1",
"^/("+usualUrlCharClasses+"*)\??(.*)" => "/sapphire/main.php?url=$1&$2",
)
Just add $myMethod in your template (e.g. page.ss) and you will get data from your method. You can also do it by browsing to http://www.mysite.com/mypage/mymethod/
These are some general notes relating to the creation of a site that didn’t do things ‘normally’ (e.g. it doesn’t use cms/ or jsparty/, just the sapphire/ core)
Please use comments for notes, tips and corrections about the described
functionality.
Use the Silverstripe Forum to
ask questions.