Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Building an Internationalized Blog with FigDice
Nov 26, 2014 @ 15:55:44

On the SitePoint PHP blog they've posted the second part of the series looking at using the FigDice for the templates in your application. In this new post they expand on the basics presented in part one and look at internationalization.

In part one of this two-part series I started looking at FigDice, a PHP templating system that takes a slightly different approach to most. [...] In this second and final part we're going to add a simple blog to our example site, which allows us to look in more detail at Figdice's concept of data feeds. We'll also look at internationalization, translating some of the site's content into a couple of additional languages.

In this part of the series (part two of two) they create a simple blog application based on their "Feed" class from before, faking some basic content. He then creates the factory class the FigDice templating will fetch the data from and makes a view to use it. He also talks about the optional functionality to add additional data to the feed output as attributes on the element. Finally he shows how to work all of this back into the HTTP framework under a "blog/post" URL.

tagged: internationalization figdice template library tutorial series part2

Link: http://www.sitepoint.com/building-internationalized-blog-figdice/

SitePoint PHP Blog:
Getting Started with FigDice
Nov 21, 2014 @ 18:19:12

The SitePoint PHP blog has posted the second part of their series highlighting the FigDice template rendering system. In this latest article Lukas White focuses on FigDice's ability to "pull" data into templates as needed rather than having it injected.

Amongst the many templating systems out there, most work in pretty much the same way; variables are “injected” using some syntax or another, be it curly braces, percentage signs or whatever that library’s convention happens to be. They’ll usually have basic control structures, such as if...then and, of course, iteration. FigDice, however, takes an altogether different approach. Inspired by PHPTAL – the subject of a future article – it gives the view layer the responsibility of “pulling” in the data it requires, rather than relying on controllers to assemble and “push” it into the templates.

He walks you through the installation of the tool (via Composer) and how to create a basic FigDice view to work with (including template loading). He uses a sample Silex-based application for his examples, making a layout with the FigDice additions to the attributes. He then shows how to make the template for the main index page with a "mute" region for the include logic. He shows how to include this basic template into the view and render it directly as output. Next he shows how to integrate data with the template, pulling in "tweets" from an array dataset via a loop (walk) and a factory to provide the template the data.

tagged: figdice template tutorial series part2 data integration

Link: http://www.sitepoint.com/getting-started-figdice/


Trending Topics: