Ever wanted to generated PDF documents on the fly with PHP? Perhaps populate a standard contract with a customers name and address? FPDF and FPDI are two neat libraries which greatly helps when working with PDF files. FPDF is the main library for handling PDF files, while FPDI lets your import existing PDF documents into the FPDF documents. In the code sample I’ve prepared here I’m importing a PDF template document, writing some information to the document, then sending it to the “customer”. FPDF offers several neat ways to expose the generated document, such as a stream to the browser, a string, or just storing it to file. You can download PDF Sample code to test it.

Be sure to head on over to the FPDF site and FPDI site for more information on these two libs.

Related posts:
Generated PDFs over HTTPS with Internet Explorer

[tags]PHP,PDF,Frameworks[/tags]

We’ve been working on getting drag-drop features to work in Prado for a while now, and we got it on a level which fills our needs.

The current state lets you register drags, drops and drag-drop. The most annoying limitation we have at the moment is that you only get the drop container on callback. We currently slip around that by sending our data with the callback parameters.

The demo attached here shows dragsdrops (green), drags (yellow) and drops (blue). When an element is dropped the label is updated with the name of the drop element and the callback parameter data. The callback data is currently set up in the js file and it’s only set for the dragdrop elements, but there should be nicer ways to do this.

The component only uses javascript that ships with Prado, so no external libs are required. The actual MyDraggable php class is based on another Prado component, and it probably needs some cleanup as well. The demo ships with Prado 3.1, so just unzip and set correct permissions.

Kudos goes to my co-worker Lars-Olav for getting the client side stuff to work. Javascript is not my strong side ;)

Online demo – http://prado.eirikhoem.net/dragdropdemo/www/
Download source – http://www.eirikhoem.net/dragdropdemo.tar.gz

Update: Source file is not up to date. Will fix asap.

There has been lots of interest in the AJAX (active controls) features in Prado lately, but the lack of client side controls has been a turn-off for many. The area that’s gotten most request is drag / drop. Prado 2 had controls for this, but it’s been absent in Prado 3. Several users on the forums has been trying to get it working, but nothing has ever been completed. The main issue has been the communication between the client side scripts and the server side control (callbacks). I’ve spent some time digging trough the Prado code and created a concept control which fires a callback.

Code:

MyDraggable.js code

MyDraggable.php

Home.php

Home.page

Stay tuned for Part II which hopefully shows something more useful :)

I’ve been working on a community tutorial project for a while now. The current “release” is available here. The idea is to create a framework on top of Prado that consists of a set of interfaces, classes, components and services. With this framework people should be able to create services like Facebook, YouTube, Blogs, Online News etc with very little development time.

The main features:
* User management with permissions
* Forum
* Ads management
* Guest books
* Messages between users
* Blog / notes
* Social relations between users
* Themes and localization
* Media albums (music, movies, music)
* File uploads

The current state of the project is that I’ve pretty much set up the user system and the basics like messages and blogs. I’ll be pretty busy with work for the next month, but I also have a project which I need this framework for.. So I’ll try to get some hours each weekend to work on this. I’d really like some comments and suggestions, so feel free to email me or send me a private message on the Prado forums. My user name is eirikhm.