Pdf Generation with PHP

The topic of PDF generation with PHP used to be quite painful : PHP native functions require PDF lib, a library that does not come straight out of the box, and is distributed under commercial license. In spite of this dominant position, other solutions have been implemented and available under opensource license.

  • fpdf is probably the most famous of PHP PDF libraries. FPDF project remained inactive for years but was still very usable in its latest version, dated 2004. And finally after 4 years of inactivity a new version finally came out this august 2008, with important features such as GIF image support and possibility to have different page formats in a single document. Most interesting is the additionnal PDFTable class, which does a very good job render HTML table conversion to PDF format. That's in my opinion the easiest way for a webmaster with good knowledge of  HTML to generate PDF documents.
  • TCPDF is another example of an advanced PHP PDF generation library but I haven't tried it yet. Does seem to support some level of HTML parsing but not to the point of converting HTML tables to PDF (see above)
  • ZendPDF is a good bet as a component of Zend Framework but focuses on low level graphic functions and as such lacks essential features such as automatic word wrapping.

CMS compare : Concrete5, WordPress, Silverstripe

This article makes a quick comparison of 3 popular PHP  Content management Systems :  Concrete5, Silverstripe and WordPress. While Concrete5 and Silverstripe are two real content management frameworks, WordPress is hugely popular as a blogging platform and each new version brings new feature that make it perfectly usable as a CMS, provided you install specific plugins such as PageMash.

Read more

jobberbase : Neat PHP jobbase application

did they use a code generator ? Romanian developped JobberBase is so nicely coded that we would like to put a name on the framework that intiated this nice lightweight jobboard application. It won't bother with user registration or profile maintenance:  jobberbase is one of the simplest expression of job listing application, may be even too simple to be true. Great work has been put into the design of the frond and back using MVC paradigm, Jquery helpers and smarty templates. Good job. More @

Online Image editing : jquery’s way

My last article on Silvesrtripe CMS online image editing feature led me to investigate alternative solution for websites and software developers that wish to implement this kind of component for their backoffice.. Surfing on CAKEPHP framework homepage turned out to illustrate perfectly the kind of component that should be standard on all CMS : resizing is now pretty common, and what we want now is cropping. There is actually a plugin for jquery that does the interface job, ImgAreaSelect. ImgAreaSelect come with loads of configuration options that make it a perfect tool for cropping images : the selection area is responsive, draggable, and can be adjusted to work only within specified limits or predefined aspect ratio. What's missing in Jquery is the server side of things, and you'll find that either on webmotionUK for pure PHP or on CAKEPHP's site for Cake integration.

Create url for mod_rewrite

Creating urls with Search engine optimized keywords from database records involves more than just mod_rewrite and htaccess synchronization. The first step of a good search engine indexing strategy is to take one of your database fields as index (title is a good one) , transform it by removing spaces, special characters, and if necessary append record unique identifier to the generated string. Here is a sample function that transforms a string to make it file compliant using a regular expression to discard non alphanumeric characters and replace spaces with dashes :

function make_url($string){

$pattern = "([^[[:alnum:]|[:space:]|[:blank:]])+";
$anchor = ereg_replace($pattern, '', strtolower($string));
$pattern = "([[:space:]]|[[:blank:]])+";
$anchor = ereg_replace($pattern, '-', $anchor);
return short_name($anchor); // return the short filtered name
} # end function