Skip to content

Instantly share code, notes, and snippets.

  • Optimizing response time in SilverStripe using APC and Partial Caching

  • Customizing GridField columns. (Two methods)

    • Use $summary_fields and define custom getter:
      $summary_fields = array('FullName' => 'Full Name');
      public function getFullName() { return $this->FirstName . ' ' . $this->LastName; }
    
  • Use GridField setFieldFormatting() to customize:

@trev
trev / ss_many_many_sql.php
Last active December 18, 2015 18:49
SS Many_many Join
<?php
public function filterStuff() {
// Can't use Search Filter since the object has a base class of SiteTree
// $results = PostPage::get()->filter(array('Authors.URLSegment:ExactMatch' = 'Trev'));
// Lets go manually
$results = PostPage::get()->leftJoin(
'PostPage_Authors',
'"PostPage_Authors"."PostPageID" = "PostPage"."ID"'
@trev
trev / ss-cheat-sheet.md
Created June 13, 2013 05:40
SilverStripe 3.0 Recipes, Errors, Tips and Tricks

RECIPES

Get a specific page and access its children

Possible usage

Get the children from a specific page and add them to the main menu

Code

<% with Page("about-us") %>

<% loop Children %>

@trev
trev / vagrant.org
Last active December 15, 2015 08:59
@trev
trev / SilverStripe.3.0-Recipes-Errors-Tips-And-Tricks.md
Last active December 15, 2015 08:49
SilverStripe 3.0 Recipes, Errors, Tips and Tricks

SilverStripe 3.0 Recipes, Errors, Tips and Tricks

RECIPES

Get a specific page and access its children

Possible usage

Get the children from a specific page and add them to the main menu

Code

(function() {
window.DS = Ember.Namespace.create({
// this one goes to 11
CURRENT_API_REVISION: 11
});
})();
// Version: v1.0.0-pre.4-55-g11ab37f
// Last commit: 11ab37f (2013-01-27 14:30:02 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
// Version: v1.0.0-pre.4-10-g389a912
// Last commit: 389a912 (2013-01-20 16:30:20 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
(function() {
window.DS = Ember.Namespace.create({
// this one goes to 11
CURRENT_API_REVISION: 11
});
})();
// Version: v1.0.0-pre.2-396-gddb0951
// Last commit: ddb0951 (2013-01-14 10:16:46 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug