<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Peter Indiola</title>
 <link href="http://chocnut.github.com/atom.xml" rel="self"/>
 <link href="http://chocnut.github.com"/>
 <updated>2015-12-14T11:12:18+00:00</updated>
 <id>http://chocnut.github.com</id>
 <author>
   <name>Peter Indiola</name>
   <email>pindiola@gmail.com</email>
 </author>

 
 <entry>
   <title>Customising SilverStripe Text fieldtype using Extension</title>
   <link href="http://chocnut.github.com/2012/09/17/customising-silverstripe-text-fieldtype-using-extension"/>
   <updated>2012-09-17T00:00:00+00:00</updated>
   <id>http://chocnut.github.com/2012/09/17/customising-silverstripe-text-fieldtype-using-extension</id>
   <content type="html">
&lt;p&gt;I have this problem that I need to split the page content by paragraphs. Good thing in SilverStripe you can add custom function to an existing class using Extension. Since in the Text fieldtype we can only use the FirstParagraph method, I created a custom function that can pull paragraphs from the page content.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/3735394.js&quot;&gt; &lt;/script&gt;

&lt;p&gt;So as you can see in the above code snippet, the Paragraph function takes an argument of paragraph number and return the content to be display in the template. Oh, don’t forget to setup your _config.php so that it will override the Text class.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/3735628.js&quot;&gt; &lt;/script&gt;

&lt;p&gt;So in the template we can now call the custom function. Cool eh?
&lt;script src=&quot;https://gist.github.com/3735631.js&quot;&gt; &lt;/script&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to work with recurring dates in PHP</title>
   <link href="http://chocnut.github.com/2012/09/04/how-to-work-with-recurring-dates-in-php"/>
   <updated>2012-09-04T00:00:00+00:00</updated>
   <id>http://chocnut.github.com/2012/09/04/how-to-work-with-recurring-dates-in-php</id>
   <content type="html">
&lt;p&gt;Are you’re looking for a library that handles recurring date in PHP? Luckily there’s one on [github] (https://github.com/justinethier/When){:target=”_blank”}.&lt;/p&gt;

&lt;p&gt;So here’s a quick snippet and scenario on how to use the libary. User select a week number(s) and day(s), They also set the recurring end date or month(s). Here we call until() method that accept datetime and we call byday() method that accept array of days e.g ‘MO,’TU’ etc. then we call the next() function to loop over the generated dates. So there you go, Hopefully this post helps.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/3616101.js&quot;&gt; &lt;/script&gt;

</content>
 </entry>
 
 
</feed>