»

search

Nathan's Blog

 Useful information, web programming and books

  • Categories

  • Recent Posts

    • Phone Photos
    • Using SilverStripe CMS
  • Also At

    Last.fm Flickr Twitter Facebook Friend Feed Delicious YouTube
  • Twitter Updates

      Follow me on twitter
    • Friends

      • Ciarne's Website
      • Kate Kowald
      • Keith in Kansai
      • Koho: Kate Kowald's Etsy
      • Lucy's Website Portfolio
      • Luke Kowald's Blog
      • Nina's Maiden Marathon
      • Pocket-Ninja
      • Reece's Website
      • Tsunami Hee Ja
    • Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
    • Phone Photos

      By simply removing ‘$’ signs from prices, people are less intimidated by them.

      In six days the iPhone 4 is released. In two days I’ve had my 3GS for a year.
      Since getting my 3GS I’ve updated my moblog never.
      Here’s a selection of photos from the past year that should have gone into my moblog. Here we go.

      Kurt Vonnegut - Slaughterhouse Five

      He had a tremendous wang, incidentally. You never know who'll get one.

      This paragraph made my day. It’s from the book ‘Slaughterhouse Five’ by Kurt Vonnegut.
      Here’s an amusing anecdote about Kurt Vonnegut:

      In the mid 1950s, Vonnegut worked very briefly for Sports Illustrated magazine, where he was assigned to write a piece on a racehorse that had jumped a fence and attempted to run away. After staring at the blank piece of paper on his typewriter all morning, he typed, “The horse jumped over the fucking fence,” and left.

      ZOMG

      I associate the word 'ZOMG' with my friend Daniel

      I associate the word ‘ZOMG’ with my friend Daniel.
      Incidentally, ‘Words with Friends’ is a great iPhone app.

      For the person who empties my bin, thank you!

      For the person who empties my bin, thank you!

      I left this note and Kinder chocolate for the cleaner of my work office. I meant it as a nice gesture. I worried later the cleaner might think I was being a dick. My bin is emptied nightly, it’s great.

      The next morning I was relieved to find this response.

      Yes thank you

      Yes thank you

      Fixie Shop, near Soho

      Fixie Shop, near Soho

      I took this photo for my friend Mark, though never sent it to him. It’s a fixed gear bicycle shop I walked past a while ago in Soho, London.
      Mark has done a fixed gear bicycle conversion himself. See his documented conversion on his blog: http://solirossi.wordpress.com

      Stork Nest Live from Dumbravioara, Romania, Europe

      Stork Nest Live from Dumbravioara, Romania, Europe

      My friend Jason sent me a link to this Stork Nest webcam. I had it on my second monitor all day.
      Here’s the webcam: http://www.justin.tv/milvus#r=D9MLLPE

      Have you seen me?

      Have you seen me?

      The missing cat wrote the headline.

      Uterus

      Uterus

      This arrangement of cloths reminds me of a uterus.

      Animated Uterus

      Animated Uterus

      Big-ass keys

      Big-ass keys

      I found a keyboard with large keys in the bin at work. I salvaged the keys.

      Tooligan: well named

      Tooligan: well named

      Tooligan: well named matchbox car – seen in Sainsbury’s.

      Sylvanian families

      Sylvanian families

      My sister used to have a whole mess of these cute creatures.

      Recently Loved Web Articles  

      • Inside Australia’s data retention proposal – Communications – News
      • Kurt Vonnegut – Wikipedia, the free encyclopedia – Kurt Vonnegut’s eight rules for writing a short story
      • Horizontal Lines Made Easy in Word
      • Spicing Up Your Website With jQuery Goodness – Smashing Magazine
      • 4606951165_9d5135f268_b.jpg (JPEG Image, 1024×723 pixels)
      • WTF Winnie The Pooh [PIC]
      • Boost for London’s Software Developer Community and SME’s as TfL lifts all restrictions on commercial reuse of its data | London DataStore
      • Opinion : Anatomy of the LILE « The Million Word Year – Great blog post.
      • Cooper: Photographer Cat
      • Hidden posters of Notting Hill Gate Tube station, 2010 – a set on Flickr
    • Using SilverStripe CMS

      I’ve just finished my first website using SilverStripe – a free Content Management System (CMS) built with PHP.
      I used Google a lot to find answers to questions I had; this post is a list of these questions and answers.

      SilverStripe-Logo-with-words

      My Server Environment

      Server: Windows Server 2003 R2
      WAMP: The Uniform Server – (with the latest Apache, MySQL, PHP)
      SilverStripe Version: 2.3.7

      Things I had to Google

      Change the breadcrumb separator

      This arrow symbol (») is used as the default breadcrumb separator.
      You can change this by editing /sapphire/core/model/SiteTree.php

      Search SiteTree.php for the variable named $breadcrumbs_delimeter.
      Update the breadcrumb separator to what you want.

      /**
      * Delimit breadcrumb-links generated by BreadCrumbs()
      *
      * @var string
      */
      public static $breadcrumbs_delimiter = " » ";
      

      editor.css stylesheet not being used in HTML editor

      I came across a bug where SilverStripe would not use my editor stylesheet in the HTML editor.
      This can by fixed by adding the following line to mysite/_config.php

      HtmlEditorConfig::get('cms')->setOption('content_css', 'cms/css/editor.css, mysite/css/editor.css');
      

      Alter the third parameter of the setOption method to the path where your editor.css file is located.

      Targeting Mac Firefox

      The following code with some minor tweaks can be used to target any browser / OS.
      I’m adding it here to show how easy it is to create variables for use in your templates.

      To add a variable that can be used in your templates edit /mysite/code/Page.php

      Add this function:

      function isMacFF() {
          // Get the user agent
          $userAgent = $_SERVER['HTTP_USER_AGENT'];
      
          $browser  = "Firefox";
          $os = "Mac OS X";
          $version = ""; // You could add version or anything else you are looking for here
      
          // Check the string is in the user agent
          $browserTest = strpos($userAgent, $browser);
          $osTest = strpos($userAgent, $os);
      
          // If both conditions are true we know it is Firefox for Mac
          // Add more conditions if you are testing for anything else
          if ($browserTest == true && $osTest == true)  {
              return TRUE;
          } else {
              return FALSE;
          }
      }
      

      Thanks to George Ornbo for this OS/browser targeting PHP code.

      In your main page template add this:

      <% if isMacFF %>
      
      <% end_if %>
      

      Changing /themes/apprenticeshipsfirst/css/mac_ff.css to the path of your Mac+FF CSS file.

      I would have used <% require themedCSS(mac_ff) %> to add the stylesheet but I found it adds the Mac+FF stylesheet regardless of the conditional statement.

      Creating a Dynamic Sitemap

      Creating a dynamic sitemap is simple with SilverStripe.
      Follow the instruction here: http://doc.silverstripe.org/doku.php?id=tutorial:site-map

      Admin area breaks

      While using SilverStripe I ran into an error where duplicating a webform page resulted in the admin area breaking. When the error occured a JavaScript alert popped up informing me something went wrong.
      After this I was unable to get to the admin area.

      To fix this:
      Put site into dev mode.
      You do this by adding the following line of code to /saphire/_config.php :

      Director::set_environment_type("dev");
      

      Comment out the line in the offending file – this is listed in the error message once the site is put into dev mode. In my case I commented out a line that throws an exception – in the Object.php file.

      //throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'");
      

      Now rebuild your SilverStripe database by visiting http://yoursite.com/dev/build.
      Don’t worry, this rebuild won’t delete any of your site’s content. After the rebuild visit your admin area which you should be able to get into again.
      Complete the action you were trying to do before you received the error then restore this line by removing your comment.

      404 page not being used

      In my SilverStripe installation a 404 page existed but when I typed in a URL that didn’t exist it would not use this 404 page.
      It instead showed a SilverStripe themed error page saying:

      Website Error Not Found
      The website server has not been able to respond to your request.

      After Googling the problem I found you have to publish this default 404 page before it will be used by SilverStripe.
      To publish, select your ‘Page Not Found’ page and click ‘Save and Publish’.
      Do a site flush by adding ?flush=all to the URL and it will now use this custom 404 page.

      Website not displayed using The Uniform Server

      I chose The Uniform Server as my all-in-one WAMP solution.
      I chose this because it installs with strict security settings enabled and can be used on a production server.
      When using it for the first time I ran into the problem where when I logged out of the Remote Desktop Connection for my production server it would stop serving my website.
      I found out The Uniform Server can be run as a standard program – running via logged in user – or it can be run as a service.
      When using this on a production server you want to run this as a service. To run as a service follow these directions: http://wiki.uniformserver.com/index.php/5.0-Nano:_Install_and_Run#Run_as_a_Service_.28Vista_and_W7.29

      Useful Links

      • http://doc.silverstripe.org/doku.php?id=built-in-page-controls
      • http://doc.silverstripe.org/doku.php?id=installation-on-windows-wamp
      • http://www.silverstripe.org/modules/ – hard to find on the website
      • http://www.silverstripe.org/stable-download/

      Conclusion

      SilverStripe is easy to install, use and extend.
      SilverStripe comes with all the features I was looking for:

      • Intuitive content editing
      • Search engine friendly URLs (‘this-page’ format)
      • User Management
      • Runs on Windows Server 2003
      • Developed with PHP
      • Works with Apache, MySQL
      • Easy to use templating system

      The functionality it lacked I was able to add with a module.

      I’ve used Joomla and Drupal CMS in the past and found SilverStripe much easier and quicker to build a website with.
      SilverStripe templates are great, using normal HTML with custom tags.
      The editing interface is simple and easy to use. The admin interface is more intuitive than any other CMS I’ve used.

      I recommend SilverStripe to anyone looking for a good, free CMS.

      Thanks to Reece for getting me onto SilverStripe.

    •  

    Wordpress // Photon by Jacob Andreas