Show Child pages in a Silverstripe template

David Nash silverstripe, What I'm Working On Today Leave a Comment

This allows you to create infinitely deep Silverstripe page hierarchies without having to mess around too much with navigation. Simple and effective. <% include Nav %> <div id=”Content”> <h1>$Title</h1> $Content $Form <% if Children %> <ul style=”padding-top: 1em”> <% control Children %> <li><a href=$Link>$MenuTitle </a></li> <% end_control %> </ul> <% end_if %> </div><!–Content–>

Dynamic Font/Image Replacement in Silverstripe

David Nash silverstripe, What I'm Working On Today 15 Comments

I’ve recently started creating sites with SilverStripe CMS, and I’m loving it. My client wants nicely rendered non-standard font titles that fade in and out, without using javascript. Here’s how I’m going to accomplish it: In Silverstripe’s mysite/code/Page.php I overload the onBeforeWrite() call in my Page class. This intercepts the data before it is written to the database. I can get the title of the updated page from $this->Title I will then use PHP’s GD (graphics) library to create a PNG with a transparent background. I’ll use imagettftext() to load a font from a TTF file and write it to …