Archive: September, 2015
Haversine Formula / Magic Square / Circle
This function would do this (providing you have Member extended with PostCode)
Read more about 'Haversine Formula / Magic Square / Circle'...
Read more about 'Haversine Formula / Magic Square / Circle'...
Filter used GET parameters and pass them to the current link
Sometimes you hack something together and if a special get parameter is used something should appear different on the current page.
Read more about 'Filter used GET parameters and pass them to the current link'...
Read more about 'Filter used GET parameters and pass them to the current link'...
How to speed up unit tests using sqlite
Running unit tests might be dead slow if you're using mysql for it, cause for every test a new DB is set up and destroyed afterwards.
Read more about 'How to speed up unit tests using sqlite'...
Read more about 'How to speed up unit tests using sqlite'...
Diagram of relationships in SilverStripe
After reading https://docs.silverstripe.org/en/3.1/developer_guides/model/ you might need a quick reminder on the relationships between objects... here is a quick visual reminder...
Read more about 'Diagram of relationships in SilverStripe'...
Read more about 'Diagram of relationships in SilverStripe'...
Stop default pages being created
This is created based of requireDefaultRecords in SiteTree (in cms package), this indicates that this can be stopped with a yml config (in _config/config.yml)
Read more about 'Stop default pages being created'...
Read more about 'Stop default pages being created'...
Access external database
If you wish to access an external database either with the ORM or with a direct DB::Query you can...
Read more about 'Access external database'...
Read more about 'Access external database'...
Save $many_many_extraFields when adding a DataObject to a list
Assuming you have a $many_many relation and SortOrder defined as $many_many_extraFields you can add an item to this ManyManyList and pass the extraFields as an array:
Read more about 'Save $many_many_extraFields when adding a DataObject to a list'...
Read more about 'Save $many_many_extraFields when adding a DataObject to a list'...
Changing the Name of "Settings" (aka SiteConfig)
If you wish to change the name of Settings then it cannot be done with normal methods. Create mysite\lang\en_GB.yml and update the menu title this way...
Read more about 'Changing the Name of "Settings" (aka SiteConfig)'...
Read more about 'Changing the Name of "Settings" (aka SiteConfig)'...
Re-ordering the CMS Menu Items
Manually changing the order of the menu items is a little time consuming with all the dev building, place this in your _config.php...
Read more about 'Re-ordering the CMS Menu Items'...
Read more about 'Re-ordering the CMS Menu Items'...
Dates Formatted Based on Locale
$MyDate.Format(...) doesn't format based on locale, but $MyDate.FormatI18N(...) does :)
Read more about 'Dates Formatted Based on Locale'...
Read more about 'Dates Formatted Based on Locale'...