Including several CSS or JavaScript files in SS templates
An effective way to include several CSS or JavaScript files is the Requirements::combine_files function. It concatenates the required files. The main benefit is faster loading time and overall...
View ArticleLoading jQuery and executing a function onLoad
jQuery does not require any markup.Requirements::javascript('mysite/javascript/jquery.min.js'); Requirements::customScript(<<<JS (function($) { $(document).ready(function() { alert('jQuery is...
View ArticleModifying TinyMCE HTML Editor Toolbars in SilverStripe
HtmlEditorConfig::get('blog')->insertButtonsBefore('advcode', 'image', 'link', 'unlink', 'separator' ); HtmlEditorConfig::get('blog')->removeButtons('tablecontrols');...
View ArticleSilverStripe User Registration and Profile Management
Robust and fully featured profile/registration module allowing the creation of registration and profile management pages with custom fields and...
View ArticleStopping Xdebug in NetBeans
For some reason my NetBeans/Xdebug setup is not stopping on break points while debugging. One possibility that always works is the use of xdebug_break(); in PHP code. To trace the problem a good...
View ArticleRemoving Prototype from Templates
To remove Prototype.js from being loaded both AJAX commenting (in _config.php): PageCommentInterface::set_use_ajax_commenting(false); and the form validation (in e.g. Page.php) needs to be...
View ArticleDebugging SilverStripe
URL Debug Parameters in SilverStripe 2.4 ?isDev=1 ?isTest=1 ?showtempalte=1 ?debugmanifest=1 ?debugfailover=1 ?debug_request=1 ?debug=1Performance ?debug_memory=1 ?debug_profile=1...
View ArticleSimple way to get project/theme paths in PHP
Project Path A simple way to have the project path available is by defining a constant in _config.php:global $project $project = 'mysite'; define('PROJECT_DIR', $project); Alternatively, the project...
View ArticleCreate non-static default values
To populate $defaults with non-static values the populateDefaults() has to be overloaded in the child-class. This method is called when a new page object is created. When overloading parent...
View ArticleArticle 6
Getting started with the GridField in SS3 This short tutorial provides an example of using the new GridField in SilverStripe 3 that manages a listing DataObject.mysite/code/Listing.phpclass Listing...
View ArticleArticle 5
TranslatableDataObject - A simple way to translate any DataObjectby Uncle Cheese Productions A simple decorator class that adds translatable fields to a given DataObject subclass. Unlike the...
View ArticleArticle 4
Compiling mcrypt into PHP on MacOSX Mountain Lion 10.8The PHP version that comes bundled with OSX doesn’t include mcrypt and some other PHP extensions. They need to be compiled manually.PrereqsAfter...
View ArticleHow to disable FireFox's Inspector and remove it from the context menu?
Having used Firebug for years I found myself clicking mistakenly on the FireFox's "Inspect Element" in the context menu countless times. At some point some form of evolution kicks in and here is the...
View ArticleApache VirtualHosts and SELinux under CentOS 6
This article briefly describes how to move virtual hosts outside the standard /var/www/html directory in CentOS 6.x. By default SELinux in CentOS does not allow the httpd process to access files...
View ArticleHow to create a LESS source map
lessc --source-map=styles.map styles.less styles.css Requires lessc version 1.5+:lessc -v Install/update to the most recent version:npm install -g less
View ArticleDOM MutationObserver – monitoring DOM changes dubbing example
The following is a simple tool that allows monitoring DOM property changes. Very handy when working on interactive user interfaces, sliders or animations. Just replace the element id with the element...
View Article