https://stackoverflow.com/questions/48886669/siverstripe-dev-mode-and-admin-panel-break-the-page I have localhost SS 3.4 project, which works fine. Same project on the server works fine with one exception. I can't access the CMS (nor set the page to dev mode) I get server error, which logs as problem with DB connection:

Warning at framework/model/connect/MySQLiConnector.phpline 77: mysqli::mysqli(): (HY000/2005): Unknown MySQL server host ''


Error at framework/model/connect/DBConnector.php line 55: Uncaught SS_DatabaseException: Couldn't connect to MySQL database | Unknown MySQL...


https://stackoverflow.com/questions/48857964/how-to-add-save-publish-image-on-a-page-in-silverstripe-4 A Silverstripe 4 project has an extended Page which automatically generates a "MetaImage" on save which should then be attached to the page. Example code below:

class ExamplePage extends \Page {

private static $has_one = [ 'MetaImage' => 'SilverStripe\Assets\Image' ];

public function onBeforeWrite() {

  $metaObjectImage = new Image();
  $metaObjectImage->ParentID = $saveFolder->ID;...

https://stackoverflow.com/questions/48855128/using-pos-in-backend-admin-panel How i can show my pos in summary fields on my data object (gridfield)?

private static $summary_fields = array( 'ID' => 'Whole', 'Content' => 'Content', );

the $Pos is only available in SS template and i can't use it in Summary fields


https://stackoverflow.com/questions/48833355/whats-the-equivilent-to-formbuttonclicked-in-ss4 In SilverStripe 3, if I want to find out what button was clicked on a form (after it was submitted), I would call:


buttonClicked appears to have been removed in SilverStripe 4, does anyone have any idea how you would do the same?


https://stackoverflow.com/questions/48810203/silverstripe-install-php-cant-find-mysite I have working SS v3.4 project locally. Now I want to deploy it. I've copied files to the server, run composer install to install vendor libraries. When I run install.php all requirements are fine except for missing mysite folder errors. That's intended because I renamed my project folder to let's say mydomain and it works fine on localhost. AFAIK SS should pick up the custom folder and recognise it as THE page folder. Somehow it doesn't happen. Any ideas why?


https://stackoverflow.com/questions/48806720/silverstripe-table-name-not-set-for-class I'm just learning SilverStripe and I'm having a problem with the lessons on the silverstripe website actually.

I have this class:

namespace SilverStripe\Lessons;

use Page;

class ArticlePage extends Page { private static $can_be_root = false; private static $db = [ 'Date' => 'Date', 'Teaser' => 'Text', 'Author' => 'Varchar(255)', ];

// public function getCMSFields(){ // $fields = parent::getCMSFields(); // $fields =...


https://stackoverflow.com/questions/48797743/how-to-remove-temp-test-databases-that-silverstripes-sapphiretest-class-creates I would like to know how to make it so that temp databases are dropped after I run my Sapphire tests via YAML fixtures. Perhaps there is some code that can go in the teardown function that will drop the tmp DB?

FYI, even when all of my test pass, the tmp DB is still left behind. I know that in other phpunit frameworks, errors while running tests can cause the process to abort and thus leave behind tmp databases.


https://stackoverflow.com/questions/48795641/handling-database-when-deploying-silverstripe-site I have a small test project built with Silverstripe that I have done on my local dev machine and want to deploy it to a server. My problem is how I should handle the database that is on my dev computer.

Does it work to dump the database and import it on the server? Or does Silverstripe store information in the database that can cause problems? When I previously tried this on Wordpress it was complicated since it stored complete urls like "localhost/etc".


https://stackoverflow.com/questions/48791586/silverstripe-loads-style-sheet-even-if-i-delete-it-from-the-server I can not figure this out as I don't fully understand how Silverstripe Cache works.

I tried flush=1 and flush=all. cntrl f5 and cntrl r in the browser but no success.

After deleting the stylesheet from the server completely it is still loading!!! I Checked the console and the path and it is pulling from the correct directory which is now empty when viewing FTP.

Is there something I am missing in my settings?


https://stackoverflow.com/questions/48782226/php-5-6-modify-object-in-loop-with-if-statements-updates-latest-only In my system Cars and product category are a combination that has a EAN code. Every car can have several products catergory that have a different EAN code and I want to use the EAN code that belongs to that specific combination. I use a foreach to loop through all cars and get the right EAN code and put in in a Arraylist for the product category that it has but whenever I run my code only the latest EAN code will be used for all product categories that the car has.

For example: Car 1 has 3...