Silverstripe 2.4-highlights-gpmd

1,939 views

Published on

Published in: Self Improvement
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,939
On SlideShare
0
From Embeds
0
Number of Embeds
85
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Silverstripe 2.4-highlights-gpmd

  1. 1. Created by: Jamie Neil,Technical Director, GPMD Ltd SilverStripe 2.4 Highlights
  2. 2. Contents <ul><li>Installer
  3. 3. SiteConfig
  4. 4. Nested URLs
  5. 5. Roles
  6. 6. Files & Images
  7. 7. Shortcodes
  8. 8. Databases
  9. 9. Performance + caching
  10. 10. i18n </li></ul>
  11. 11. Installer <ul><li>Simplified
  12. 12. Choice of databases </li><ul><li>Requires correct module is pre-installed </li></ul><li>Sets default language
  13. 13. Cached install page problem seems to be fixed </li></ul>
  14. 14. SiteConfig <ul><li>Site wide user configuration </li><ul><li>Interface located in root of Site Content tree </li></ul><li>Accessible in templates as $SiteConfig.Value </li><ul><li>e.g. $SiteConfig.Title </li></ul><li>Defaults: </li><ul><li>Title – Used as site name
  15. 15. Tagline – The site strapline
  16. 16. Theme – allows theme to be selected by user </li></ul><li>Extendible through DataObjectDecorator </li></ul>
  17. 17. Extending SiteConfig SiteConfigDecorator.php: class SiteConfigDecorator extends DataObjectDecorator { function extraStatics() { return array ( 'db' => array ( 'Copyright' => 'Varchar(255)' )); } function updateCMSFields(& $fields ) { $fields ->addFieldToTab( &quot;Root.Main&quot; , new TextField( &quot;Copyright&quot; , _t( 'SiteConfig.COPYRIGHT' , &quot;Copyright&quot; ))); } } _config.php: DataObject::add_extension( 'SiteConfig' , 'SiteConfigDecorator' );
  18. 18. Nested URLs <ul><li>Makes site URLs match SiteTree
  19. 19. Useful for sites with large numbers of pages or complex hierarchies </li><ul><li>e.g. /locations/london/contact-us </li></ul><li>Setup added to _config.php by installer </li><ul><li>SiteTree::enable_nested_urls();
  20. 20. May be disabled if old style flat URLs preferred </li></ul><li>Many thanks to Andrew Short </li></ul>
  21. 21. Security <ul><li>Delete Members! </li><ul><li>Previously only removed from groups
  22. 22. Interface located in root of Security Groups tree </li></ul><li>Use Roles to bundle permissions </li><ul><li>Useful for more complex security requirements
  23. 23. Roles can only be assigned to Groups </li></ul><li>Bulk import Members and Groups </li><ul><li>CSV format </li></ul></ul>
  24. 24. Files & Images <ul><li>Manual asset discovery </li><ul><li>“Look for new files” button
  25. 25. No longer triggered automatically on clicking tab </li></ul><li>Unused files removed (at last!) </li><ul><li>Never really worked properly
  26. 26. Caused serious memory problems with big folders </li></ul><li>Install DataObjectManager for more options... </li></ul>
  27. 27. DataObjectManager (DOM) <ul><li>Extension to ComplexTableField </li><ul><li>Now updated for 2.4 </li><ul><li>http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/ </li></ul><li>Adds column sorting, live search/page sizing, custom filtering, and drag/drop ordering
  28. 28. Can be nested if required </li></ul><li>File and Image DOM classes add further features </li><ul><li>Thumbnails, image labels and file type/size filtering </li></ul><li>Features should really be part of core CMS </li></ul>
  29. 29. Shortcodes <ul><li>Fields can now use BBCode style Shortcodes </li><ul><li>[shortcode]
  30. 30. [shortcode arg=&quot;example&quot; /]
  31. 31. [shortcode]enclosed content[/shortcode] </li></ul><li>Used by SiteTree to handle internal links </li><ul><li>e.g. A link to a page with an ID of 42 would use
  32. 32. [sitetree_link id=42]
  33. 33. Means that changes to url segments or even position in sitetree won't break links </li></ul></ul>
  34. 34. Registering Shortcodes Page.php: class Page extends SiteTree { public static function test_shortcode_handler( $args ) { if ( isset ( $args [ 'string' ])) { return strrev( $args [ 'string' ]); } } } _config.php: ShortcodeParser::get( 'default' )->register( 'page_test' , array ( 'Page' , 'test_shortcode_handler' ));
  35. 35. Alternative Databases <ul><li>No longer restricted to MySQL </li><ul><li>Still the default though </li></ul><li>Modules available for: </li><ul><li>Microsoft SQL Server 2008
  36. 36. PostgreSQL >= 8.3
  37. 37. SQLite3 </li></ul></ul>
  38. 38. Performance <ul><li>Site Content tree optimisations </li><ul><li>Makes admin UI usable with larger trees </li></ul><li>Files & Images memory usage cut </li><ul><li>No problems with large numbers of assets </li></ul><li>Support for Microsoft WinCache </li><ul><li>PHP bytecode cache </li></ul><li>Partial template caching </li><ul><li>In addition to static publisher </li></ul></ul>
  39. 39. Partial Caching <ul><li>Allows caching of parts of a template </li><ul><li>More flexible than static publishing </li></ul><li>Cache until TTL expires (default 10 mins) </li></ul><% cached %>$DataTable<% end_cached %> <ul><li>Each cache block has a cache key </li><ul><li>Comma separated list of tokens
  40. 40. Contents are recalculated if key changes </li></ul><li>Key includes template name and SHA1 hash </li><ul><li>So cache is refreshed when templates are edited </li></ul></ul>
  41. 41. Partial Caching Examples <ul><li>Cache until page is changed </li></ul><% cached LastEdited %>Lots of page content<% end_cached %> <ul><li>Login box </li></ul><% cached 'loginblock', CurrentMember.ID %> <ul><li>Nesting </li></ul><% cached LastEdited %> Lots of cachable content <% cached Member.ID %>Hello $Member.Name<% end_cached %> <% end_cached %>
  42. 42. More Partial Caching <ul><li>Aggregates </li></ul><% cached 'categorylist', Aggregate(Category).Max(LastEdited) %> <ul><li>Conditionals </li></ul><% cached if Busy %> <% cached unless CurrentUser %> <ul><li>Cannot be used inside If and Control blocks </li><ul><li>RelationshipAggregates may be used instead </li></ul></ul><% cached RelationshipAggregate(Children).Max(LastEdited) %>
  43. 43. i18n <ul><li>Translatable now stable after 2.3 issues </li><ul><li>i18n::set_locale('en_GB');
  44. 44. Translatable::set_default_locale('en_GB');
  45. 45. Object::add_extension('SiteTree', 'Translatable'); </li></ul><li>Each language has a different site tree </li><ul><li>But they still share same URL space
  46. 46. Adding root language pages can help </li><ul><li>e.g. /en/ and /fr/ </li></ul></ul></ul>
  47. 47. Others <ul><li>JSParty replaced with thirdparty folders </li><ul><li>jQuery 1.4 + jQuery UI 1.8
  48. 48. Zend (Date, Log, Currency, Cache) </li></ul><li>Broken Links Report
  49. 49. Dependent Pages
  50. 50. ModelAdmin stable
  51. 51. Lots of bugs fixed! </li></ul>
  52. 52. Contact GPMD Ltd http://www.gpmd.co.uk [email_address] Tel: 020 7183 1072

×