 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Alessandro Nadalin: Integrating Twig in Your Legacy PHP Code
by Chris Cornutt June 18, 2013 @ 10:19:49
Alessandro Nadalin has posted a two part series to his site to help you get the Twig templating tool integrated with your legacy codebase.
It might happen that you are working on a legacy code that is years old, with its own templating mechanism1 that doesn't really allow you to take advantage of the benefits that a structured and object-oriented engine like Twig. In this situations, when a complete replacement would cost too much to your organization, you can take advantage of a wild integration between this advanced template engine and your existing code.
In the first part of the series, he proposes integrating it at the base level, essentially wrapping the "render" method of your framework of choice. In the second part of the series, though, he comes back with a "less wild" approach that also lets you take advantage of some of the other features twig has to offer. He modifies the previous example to output a template file and reuse that in the Twig "render" call.
voice your opinion now!
twig legacy codebase integration template render
Bertrand Mansion's Blog: Twitter Bootstrap and the QuickForm2 Callback Renderer
by Chris Cornutt September 26, 2011 @ 12:23:41
In a new post Bertrand Mansion shows how he combined the versatility of the PEAR QuickForm2 package and the Bootstrap project from Twitter to quickly make a form using the project's styling (CSS).
I don't know about you, but for me building HTML Forms and styling HTML Forms are maybe the most boring things in web development. It's repetitive and takes a lot of time to do things correctly. That's why tools like Twitter's Bootstrap and PEAR's HTML_QuickForm2 can help with this part of our job. Wouldn't it be nice to have QuickForm2 generate a markup compatible with Bootstrap CSS, so that you could get a nice looking form without to much efforts? Well, that's what I plan to do here.
He starts by creating a simple QuickForm2 form with no renderers attached (no pre-defined styles) and a custom render callback that wraps the items in "div" tags with the correct styles. There's also a custom renderer included for grouping items with additional styling attached.
voice your opinion now!
twitter bootstrap pear quickform2 callback style render css
DevShed: Violating the Liskov Substitution Principle - PHP
by Chris Cornutt June 30, 2011 @ 08:36:31
On DevShed today there's a new tutorial posted talking about the Liskov Substitution Principle (part of the SOLID set of principles) and how to use it in a practical example using some object-oriented PHP.
However, not all is bad with Inheritance. When used properly it can be a great ally. The question that comes to mind is: how can you keep away from building derivatives that behave totally different from the chosen abstraction(s)? Here's exactly where the Liskov Substitution Principle (LSP) comes into play.
They choose to illustrate the principle in the form of a view renderer that, when an unintentional issue happens, throws a new exception. He creates the abstract class to generate the view objects and creates a few child objects that extend it. using these, he creates a set of templates that render a header/footer/body with the data given. The problem comes up when he tries to work with his objects and a partial view instead of a composite view is passed in.
It's a complicated situation to follow, but it does help make the principle a bit more clear. I'd suggest following it all the way through and possibly even trying out their code (included) to make it even more clear.
voice your opinion now!
liskov substitution principle tutorial view render exception
Michael Maclean's Blog: Using Pango for PHP a taster
by Chris Cornutt February 22, 2011 @ 12:58:27
Michael Maclean has a new article today talking about the Pango graphics library and how it can be coupled with the Cairo PECL extension to more easily create better looking text in dynamic images.
The PECL/Cairo library is pretty good at drawing vector graphics (in our opinion, as the developers, at least!), but one thing it's not able to do by itself is draw text with mildly advanced layout. [...] That's because the developers of the Cairo library decided to let another more specialised library handle the job of text layout.
Michael has created a wrapper for Pango in PHP (github) and some sample code that can be used as a test to ensure it's all setup and working. He steps through each part of the image creation and describes what's happening and what each method is doing along the way.
voice your opinion now!
pango image creation cairo text render tutorial
Till Klampaeckel's Blog: Zend Framework Slow automatic view rendering
by Chris Cornutt March 30, 2010 @ 14:50:16
In a new entry to his blog, Till Klampaeckel looks at view rendering for Zend Framework applications and how, as he assumed it would, making a change in the automatic rendering on the views could speed things up quite a bit.
My thesis is that there's a gain in page rendering time when I disable automatic view rendering and use explicit render calls ($this->render('foo');) inside my controllers. And to cut to the chase, there is. On our app, I measured a 12% improvement using Xdebug's profiler - simple before-after-style.
He talks a bit about his setup for testing his theory complete with a customized loader as well as the platform (OS and web server) he ran the tests on. He used Xdebug to run the testing. His conclusion is a pretty obvious one - what you gain in convenience you sacrifice in performance.
voice your opinion now!
zendframework view render automatic
Vinu Thomas' Blog: pChart - PHP charting library
by Chris Cornutt October 22, 2008 @ 07:53:00
Vinu Thomas points out a nice looking PHP charting library on his blog today - pChart.
Looking for some good looking graphs without having to pay for a library or resort to Flash graphs? Try creating your own using pChart. pChart is a PHP class oriented framework designed to create aliased charts. This project focuses on allowing developers to generate great looking graphs by increasing rendering quality introducing an aliasing algorithm.
It uses GD to create the graphs, so just about any PHP distribution out there will support it (if you're not sure, make a phpinfo() page to check out your setup). There's even some example graphs so you can get an idea of what some of the end results could be.
voice your opinion now!
pchart chart library gd graphics image render
Christian Weiske's Blog: PEARhd steaming on
by Chris Cornutt October 16, 2008 @ 08:49:02
Christian Weiske set out on a project - no small thing - to convert the current PEAR documentation info over to the PhD DocBook rendering system. In a new post he talks about the conversion process and some of the technology involved.
The reason for PhD to exist was that the previously used DSSSL based system was slow: a full build (all formats and all languages) took 24 hours to complete. Further, the tools the system based on were old, rusty and nobody understood why they broke on some machines, but also why they worked on other ones. Having a php-based system for PHP ensures that there is always someone around who can fix it if it's broken. This wasn't the case with the old documentation build system.
The conversion was spurred on by the fact that the PEAR documentation stopped building and more and more people were finding it hard to build on their machines too. He walks through the steps he took - installing PhD, converting over the docs to the DocBook 5 format and the first builds with the new system.
Now that at the XML was shiny, too, it was time to actually use PhD on it. The numbers were amazing: While a build for one format and one language took around 40 minutes on my system (dual core Macbook with 2GHz and 2GiB RAM), building the same with PhD takes 45 seconds!
voice your opinion now!
pear documentation docbook phd render xml xsl
|
Community Events
Don't see your event here? Let us know!
|