Snippets » miscellaneous
02
Jul
11
A _config.php Cheatsheet
If your anything like me, you've probably found yourself going through your previous sites looking for that line of code to put in your _config.php file. Well, now you nolonger need to, simply bookmark this page and return to it any time you need to add a line to your config! And if I've missed out anything leave a comment and I'll make sure it gets added :)
Read More >>22
Mar
3
Using other systems together with Silverstripe
Submitted by Yuri Goul
Silverstripe uses mod_rewrite to catch all calls to your website in the form of urls and route them to sapphire/main.php. This behavior is implemented with the rules in your .htaccess file in the root of your site. This can become a problem when you want to use other systems together with Silverstripe because you simply can not reach the url of those other systems.
An example: if your want to use phplists as a newsletter system, it is usually installed under yoursite.com/lists. However, under normal circumstances you can not have your visitors reach yoursite.com/lists when using Silverstripe because it is rerouted to sapphire/main.php?url=lists.
Read More >>
25
Nov
1
Extend Meta description beyond 255 character limit
Submitted by Marijn Kampf
Search engines prefer to display a description in their result pages that include the keywords searched for, to ensure they pick and mix sentences from your meta description rather than random bits from your page it can be helpful to have a longer meta description. This allows for more room to include your keywords.
Changing the field length couldn't be simpler, in the file mysite/code/Page.php add the MetaDescription type as Text.
11
Nov
0
Add Syntax Highlighting to the SS Forums
Submitted by Dalesaurus
Get Firefox, install Greasemonkey, Then install the following userscript:
http://www.silverstripe.org/assets/Uploads/silverstripeforumscode0.1.user.js

Updates and more here: http://www.silverstripe.org/general-questions/show/272688
Read More >>28
Oct
4
Overriding Silverstripes language files with your own
Submitted by Marcus Dalgren
In my most recent project I've had to run a site in another language (Swedish) and run into some issues which I thought I'd share with all of you.
Now Silverstripe probably comes with a translation for your language but even if it does, you probably want to change the wording of some of the phrases, so what to do?
You could of course hit up the language files for the relevant module or the ones in cms and sapphire but you really don't want to touch these files if you can help it.
Read More >>06
May
1
Creating a Page Export Function
Need 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':
Now you just need to create Page_Export.ss, and direct the user to the URL "/export/". Your page will be returned to the browser as an attachment to download.
Read More >>
23
Mar
3
Dynamic Year Function
Using this function you can create a dynamic year in the footer of your
site. Simply add the function to your Page_Controller class and use
$Year in your footer template.
This will output "2009" for this year and then "2009-2010" next year etc.
Read More >>