Home - Your one stop SilverStripe learning resource
- Show all
- CMS
- Security
- DataObjects
- Site Tree
- Images
- CSS
- Templates
- Forms
- Member
- Decorators
- SiteConfig
- WYSIWYG
- Errors
- Database
- JavaScript
- Comments
- Themes
- SilverStripe
- SSBits
- URLs
- Translations
- Languages
- Login
- Site of the Month
- Relations
- DataObjectManger
- Screencast
- Installing
- cPanel
- Model Admin
- Controllers
- interview
- SilverStripe 3
- Review
- Search
- Reports
-
SnippetsUsing a Print Stylesheet
16 December 2009 | |
TweetOften people want to be able to print webpages without all the menus and graphics and with all the content fitting correctly onto a page. To do this you need to create a separate print stylesheet. It would look something like this:
Continue reading... -
SnippetsCreating a Page Export Function
6 May 2009 | | | Supports v2.4, v2.3
TweetNeed to create an 'export' function for a page? Do it quickly and cleanly with HTTP::sendFileToBrowser. In your page controller, add a new action 'export':
Continue reading... -
SnippetsManipulating every Nth item in a <% control %> loop
16 July 2009 | | | Supports v2.4, v2.3
TweetOften you will want to manipulate every nth item inside a <% control %> loop. For example say you had a gallery and you wanted every 3rd image to start on a new line, you need to be able to test each item from the template to see if it is divisible by 3 and should therefore have the clear CSS class added to it.
Continue reading... -
TutorialsCreate a front end theme switcher
17 August 2009 | | | Supports v2.3
TweetSo you wanna make a demo site for your customers to show all your template skills in one site. A simple theme switcher can come in handy. It's quite easy to implement this.
First add two new functions to your Page_Controller class:
Continue reading... -
SnippetsSelect a theme using a URL parameter
21 December 2009 | |
TweetWhen I develop SilverStripe sites, I usually get functionality working in the default theme blackcandy before getting it working in the final templates. This way, authors can start adding content and seeing how it looks on the page, and I can get early feedback about the functionality. Also, as a developer I get to see real content in the browser early in the process. So does the designer.
Continue reading... -
SnippetsUsing Dates in Foreign Languages
17 November 2009 | | | Supports v2.4, v2.3
TweetWith all the translatable, i18n and other translation related stuff in silverstripe, I think more than one is wondering how to achieve something simple as using dates in a foreign language... Actually, it's ultra easy if you add this 2 lines in your silverstripe powered website.
Continue reading... -
SnippetsGetting objects from multiple child pages
14 April 2009 | | | Supports v2.4, v2.3
TweetWhen you want to create a DataObjectSet encompasing objects from all the current pages children you can do something like this
$pageIDs = $this->getDescendantIDList(); $ObjectSet = DataObject::get( "Object", "`ObjectPageID` IN (" . implode(",", $pageIDs) . ")" );Continue reading... -
SnippetsDisable Default JavaScript Behaviours
15 February 2010 | | | Supports v2.4, v2.3
TweetBy default SilverStripe uses bulky and sometimes unwanted JavaScript libraries to handle form validation and AJAX page commenting features. Often you want to disable this behaviour so you can integrate your own JavaScript code. This is easily achieved with the following two lines in you site configuration file:
Continue reading... -
SnippetsDisplaying Fields From a Set of Pages on Another Page
25 May 2009 | | | Supports v2.4, v2.3
TweetAlthough ultimately requiring very little code, displaying data from a set of pages on another page can seem confusing for those new to SilverStripe. This example will display all of the Images from all the staff pages on our current page. This works by first returning all the staff pages to our template and cycling through each of them, drawing the Image for each one.
Continue reading... -
TutorialsMaking a hierarchy aware templating system
21 September 2009 | |
TweetSomething that has been bothering me when building larger sites with SilverStripe is that I often find myself creating new classes not to add functionality, but to just get a new template.
You can set separate templates for different actions manually but that's not what I want in this case, I want different templates for the same action on the same class.
After thinking about this for awhile I came up with a two part solution and the first part is to make the template choosing aware of the Sitetree hierarchy.
Continue reading... -
TutorialsUsing a Thickbox Modal Window with AJAX
11 September 2009 | | | Supports v2.3
TweetThickbox is a great javascript plugin to jQuery that you can use to create modal windows within SilverStripe pages. You can de-clutter your interfaces and re-use small snippets of common functions when you add in AJAX. Before we begin there is a little homework:
Continue reading... -
TutorialsAutofill MetaDescription and MetaKeywords on page save
28 July 2009 | | | Supports v2.4, v2.3
TweetMost of my customers don't want to add meta info manually, so I add an onBeforeWrite() function to update the Meta Description field and count the keyword density of the content with a separate function and add these keywords to the Meta Keywords fields when a page is saved.
In my humble SEO opinion every page needs an unique Meta Description. Keywords seems to be less important for search engines, but why not add them automatically anyway! The function counts how many times each word exist in the Content, order the words by occurrence and glues the words to a comma separated string. In this function only words with more then 4 characters are counted, but you can adjust that if you like.
Continue reading... -
BlogAn Example CSS Framework
24 March 2008 | | | Supports v2.4, v2.3
Tweet
A CSS framework is a set of pre-prepared style sheets that can be used as a starting point for any project. Using a framework allows you to skip all the tedious parts of getting the basics right and lets you start working on what makes your site different from the beginning.
Continue reading...