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
-
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... -
SnippetsClearing the Search field on click with jQuery
5 August 2009 | |
TweetAs with everything, it's attention to detail that makes great sites. One thing that really bugs me is when a site has a search box with the word 'search' inside it but which does not clear it self when clicked, meaning I have to clear it before I can search. Given it can be achieved with a few lines of jQuery, it's a real surprise how many sites fail to implement this, or that still use the 'onclick' inline javascript event.
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... -
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... -
TutorialsWorking with banners
13 July 2009 | | | Supports v2.4, v2.3
TweetMost of the sites I work on are for corporate/business clients and there is not typically a lot of fancy motion graphics going on. I do like to ensure there is some dynamic element going on, just to provide a bit of interest and one of the simplest ways to achieve this is by some variation of the random/rotating banners scenario. Of course this could equally apply to other parts of the page, not just banner graphics.
Continue reading... -
TutorialsCreating Previous and Next Buttons on a page
28 June 2009 | | | Supports v2.4, v2.3
TweetWhen you have a number of pages which follow on from one another you may find that asking a user to return to an index or select the next item from a side menu each time they want to progress is cumbersome. In this situation having previous and next buttons at the bottom of a page becomes very useful. In this snippet we'll add these buttons and also a counter to show the current page we are on and the total number of pages.
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... -
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... -
NewbiesCreating a Simple Contact Form
3 May 2009 | | | Supports v2.4, v2.3
Tweet
In this tutorial we are going to create a very simple contact form, like those commonly seen on most contact-us pages. This is a great introduction to SilverStripe forms for those new to the Subject and should also provide enough functionality for most people to use straight out of the box.
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... -
NewbiesBuilding a SilverStripe Theme from a Static Template
26 March 2009 | | | Supports v2.4, v2.3
Tweet
In this tutorial we are going to create a SilverStripe theme from a static template. While completing this tutorial, you will build a good foundation for using the SilverStripe templating language and be able to create themes with dynamic menus and content areas.
Continue reading... -
SnippetsResizing and Manipulating Images
22 March 2009 | | | Supports v2.4, v2.3
TweetYou can resize images from within the template very easily. But sometimes you need to resize it and just use the URL value, something you can't do by calling the resize on the variable directly (e.g. $Image.CroppedImage(200,200)). This is how we would create a cropped resize of it and still be able to use just the URL, allowing a custom <img> tag.
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...