Resources: SilverStripe
Mambot through SilverStripe page content
1 October 2012
Sometimes it is just not worthwhile creating a new page type just for one tiny piece of functionality. Or perhaps you want the in-page functionality protected from accidental client tanpering? Either way, you can run functionality quite easily from within the page content with this crafty search and replace.
Page.php (inside the controller, ie Page_Controller class)
/* === MAMBOT TO ALLOW FUNCTION RUNNING FROM WITHIN ARTICLES === */
function Content() {
// get current content
$newContent = $this->Content;
// if our pre-definined flag is in the content
if( substr_count($newContent, '$TextInsideContent') > 0 ){
// replace the flag with the content of our function
$newContent = str_replace('$TextInsideContent', $this->CustomFunction(), $newContent);
};
return $newContent;
}
SilverStripe White Screen Of Death
27 September 2012
Debugging a SilverStripe website? Lose the impossible-to-debug ‘White Screen of Death’ with these codes:
_config.php
error_reporting(E_ALL);
.htaccess
php_value display_errors On
Reserved functions from Controller and Model
29 September 0012
If you are struggling to find out why your page’s static $db fields aren’t working, it may be due to the field name or function names.
You cannot use PageIntro as a $db field, nor can use you use GetPageIntro in your controller (ie Page.php) as a function to return content to your templates. These are protected functions. Hopefully this helps someone else out.
Expandable CMS Widgets
27 September 2012
Hide and show large widgets with this handy add-on.
Add to /themes/YOURTHEME/css/cms.css
/* — WIDGETS HIDE/SHOW — */
.usedWidgets .Widget {
position: relative;}
.usedWidgets .Widget .expand {
position: absolute;
top: 4px;
right: 20px;
color: #FFFFFF;
font-weight: bold;
cursor: hand;
cursor: pointer;}
.usedWidgets .Widget.collapsed .widgetDescription,
.usedWidgets .Widget.collapsed .widgetFields,
.usedWidgets .Widget.collapsed .deleteWidget {
display: none;}
Add to /themes/YOURTHEME/js/cms.js
$('.usedWidgets .Widget .expand').live( 'click', function(){
$(this).closest('.Widget').toggleClass('collapsed');
});
SilverStripe 2.4.7
27 September 2012
Now that the brand-new SilverStrip 3.0.1 has been launched, most of us are keen to get our clients on the bandwagon and start developing with the flash new tools. However, if you have a more conservative client and want to stick with a highly stable release (2.4.7), then getting your hands on it can be rather difficult. So if you really don’t want to go 3.0.1 just yet, I have just the link for you.
SilverStripe CMS: A slight mind warp
26 May 2011
Being a web designer/developer from Wellington, and given the ‘support local businesses’ attitude, I thought it was necessary to get my head around the Wellington-based SilverStripe Content Management System.
Coming from Joomla!, I expected a module-driven, highly customisable CMS but was instead greeted with a simple interface that had clearly been designed for the end user/client.
With further investigation I began to appreciate the power of the ‘Stripe and it’s code-monkey orientation. Once you get your head around Object Oriented Programming, you can do almost anything. It’s just that initial learning curve that is the killer.
So far, in business, it looks like a very promising CMS to present our client’s websites with. It provides a very logical author backend so the client doesn’t have to be re-trained to learn how to write his own site.
But, be warned, the official documentation is outdated and updates are sparse – an effort from the developers to promote their hosting service. The business world can be a gross place.
Find out more about the SilverStripe CMS at http://www.silverstripe.org