SSbits - Home page
Site by Carbon Crayon
Submit a Post >
  • TutorialsUsing SilverStripe Environment files for Database Configuration

    2

    Wouldn'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...
  • TutorialsRotating and Greyscaling Images using GD and Decorators

    2

    SSBmanipulatingimages

    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...
  • TutorialsCreate a front end theme switcher

    2

    So 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...
  • TutorialsAdd flexible MetaTags control to Pages

    2

    When you display DataObjects as if they are a single Page or use a Page Action to display a different view of the same Page, by default your MetaTags are the same as the tags you entered in the CMS.

    One way to change the MetaTags dynamicly is to add a lot of template controls to display different MetaTags for each view, but you can get a lot more flexibility by overriding the SiteTree MetaTags function in your Page_Controller.

    Continue reading...
  • TutorialsUsing a nested controller for generic URL handling

    2

    In this tutorial we'll be taking a look at SilverStripes nested controller concept and how you can use it in your own projects. Keep in mind though that this tutorial is probably for the more advanced users and for those who whish to learn abit more about how SilverStripe works. I will be referencing Controllers Instead of Pages by Ty Barho and the nested controller we'll be building will be for handling his scenario.

    I have also taken the liberty of including a zip file which contains all the code examples from Tys tutorial + the new controller and the new URL rule for it.

    Continue reading...
  • TutorialsWeb 2.0 Mirrored Images

    1

    SSBreflections

    Ever wanted to create the so-called 'web 2.0' mirrored images as you can see on http://www.dio5.com/portfolio/, without having to manually rotate and proces the image? Then this one is for you.

    I have attached a fully working zip-package, but let's run through some of the code nonetheless.

    Continue reading...
  • TutorialsSorting on a related DataObject in ModelAdmin

    1

    Sometimes, in ModelAdmin, we want to be able to have a different default sort.

    Specifically, like in cases where a has_one is the preferred sorting. For example, we have a warehouse. In our DataObjects, we have the object "Lanes", has_many Products. And we have Products, has_one "Lanes". When we're browsing our Products in the admin, we want to have them default sorted by their Lane, not their name.

    Just saying default_sort = 'Lanes'; sadly does not do the job. It'll give you reddish-screens and stuff. Which is not what we like.

    Here's a (quite simple actually) solution.

    Continue reading...
  • TutorialsMaking a hierarchy aware templating system

    0

    Something 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

    0

    Thickbox 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

    0

    Most 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...

Advertisement

Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image Daniel Hensby
3 article image Marcus Dalgren
4 article image Hamish Campbell
5 article image Ty Barho
6 article image njorndare
7 article image Martijn van Nieuwenhoven
8 article image Darren-Lee
9 article image Roman Schmid
10 article image Matt Clegg

View full leaderboard


Advertisement