Tutorials - Big bits of code to help you do more
-
TutorialsImproving image quality by preventing correctly sized images being resized
7 January 2011 | | | Supports v2.4, v2.3
Tweet
Sometimes you'll have to create websites for clients that are very demanding when it comes to image quality, say graphic designers or photographers. SilverStripe can be a showstopper here, since images are always being re-saved when you're using something like $SetHeight in your template. This can reduce image quality quite a lot, especially when using JPEG images.
Continue reading... -
TutorialsRegistering Users and allowing them to edit their details
20 December 2010 | |
Tweet
These days many sites require users to register to get full functionality (SSbits included!). This is something that although not avaiable out of the box in SilverStripe is quite strait forward and a great way to gain a better understanding of both the Member and Form systems. In this tutorial we are going to create a simple registration form and a page for users to then edit their details.
Continue reading... -
TutorialsRotating and Greyscaling Images using GD and Decorators
8 December 2010 | | | Supports v2.4
Tweet
Some of you might have noticed that SilverStripe's GD class has a couple of interesting looking functions, namely rotate($angle) and greyscale($Red, $Green, $Blue). However it was never quite clear how to use these functions (at least not to me anyway!). So after a bit of trial and error, it turns out it's pretty simple to achieve by decorating the image class and adding a couple of simple functions...
Continue reading... -
TutorialsQuick & Easy Google Analytics with SiteConfig
24 November 2010 | | | Supports v2.4
Tweet
Many people need a way to monitor their website, and while it's pretty easy to add the code to a SilverStripe template, or even the basic Page_Controller, I thought I would show how I modularized and made it accessible from the SiteConfig area of the CMS.
Continue reading... -
TutorialsDataObjects as Pages - Part 2: Using Model Admin and URL Segments to create a product catalogue
14 November 2010 | | | Supports v2.4, v2.3
Tweet
We now know the basics of using DataObjects as Pages from Part 1 of this tutorial. In part 2, we are now going to look at taking this further and creating a basic product catalogue with products that are DataObjects managed via the ModelAdmin interface. This tutorial will also serve as an introduction to ModelAdmin it self, which is an extremely powerful CRUD (Create, Read, Update, Delete) manager for any type of DataObject, whether used as pages or not.
Continue reading... -
TutorialsEmbedding a contact form in a sidebar
28 October 2010 | | | Supports v2.4
TweetIn this tutorial we are going to add a form to a sidebar that can be included on any page on a website. You will be able to set whether to show the Form on a particular page via checkbox in the CMS. The work is based on the Working with SiteConfig and Creating a Simple Contact Form tutorials.
Continue reading... -
TutorialsPaginating a filtered DataObjectSet
25 October 2010 | | | Supports v2.4
TweetIf you have ever tried to paginate a DataObjectSet that has been customised since fetching it from the database you will have descovered that it simply doesn't work. This short tutorial provides some great code to resolve this problem and paginate to your hearts content!
Continue reading... -
TutorialsDynamically Generating Dropdown Lists
13 October 2010 | | | Supports v2.4, v2.3
TweetThis post title may look familiar, but it has in fact been completely re-written with lots of new code! When using dropdown menus, you will often want to dynamically generate the options, usually to a list of DataObjects or Pages for the user to choose from. This tutorial explores the options at your disposal when it comes to creating dynamic dropdowns in the SilverStripe.
Continue reading... -
TutorialsDataObjects as Pages - Part 1: Keeping it Simple
4 October 2010 | | | Supports v2.4, v2.3
Tweet
In this two part tutorial, I am going to show you how to display DataObjects as if they were pages. This is often very useful for times when you have lots of items that don't warrant full site tree objects, but do need to be displayed on their own on the site. In this first part displaying Staff Members we are going to keep it simple, using a Data Object Manager to manage our Staff Members and referring to their ID in the URL. Later in part 2, we will see how to use ModelAdmin to manage a Search Engine friendly product catalogue.
Continue reading... -
TutorialsUsing Short Codes to embed a YouTube video
28 April 2010 | | | Supports v2.4
Tweet
SilverStripe 2.4 has introduced shortcodes to the CMS editor. Simply, the CMS user can now add short BBCode style code to the editor area and it can then be replaced using a predefined function. For example [link id=23] could be replaced by the link to Page with an ID of 23. In fact that is exactly how internal links created in the links sidebar work in 2.4, preventing them from breaking when URLs change.
Continue reading... -
TutorialsWorking with Site Config
19 April 2010 | | | Supports v2.4
Tweet
One of the great new features of 2.4 is the introduction of a Site Config page. This allows you to put all of those fields which are not page related, such as The sites title, root access permissions and even the current theme. The SiteConfig class is simply a dataobject and so can easily be extended to include fields, relationships and functions which you can then access from anywhere in your site.
Continue reading... -
TutorialsUsing SilverStripe Environment files for Database Configuration
17 February 2010 | | | Supports v2.4, v2.3
TweetWouldn't it be easy to have a single environment configuration for all your SilverStripe sites without having to reconfigure each one individually? Wouldn't it be great not to have to change environment settings when you push your site from development to live servers? This is easy to achieve using the SilverStripe "ConfigureFromEnv" script.
Continue reading... -
TutorialsAdding an Email Field to the Page Comment Form
4 February 2010 | | | Supports v2.4, v2.3
TweetSilverStripes comment system is great when you don't need anything more than the standard feilds, but as soon as you need some extra functionality, things get a little complicated. In this tutorial we will be adding an Email field to the comment form.
Continue reading... -
TutorialsEmbed flash content using SWFObject
3 December 2009 | | | Supports v2.4, v2.3
Tweet
There are numerous ways to embed flash content into your SilverStripe Website. A commonly used and very flexible method to embed flash is provided by the SWFObject script. In this snippet I'll show you how to create a custom FlashPage that will contain flash content, embedded using SWFObject.
Continue reading... -
TutorialsUsing jQuery for form validation
13 November 2009 | |
Tweet
As you may have noticed, SilverStripes built in form validation is based on Prototype and is pretty limited. It also means that even though you might be using jQuery for other things on your site, you will still need to load prototype.js and all the associated files that SilverStripe requires for it's built in JavaScript form validation.
Continue reading...