Generate PDF with fuelPHP

Generating PDF with fuelPHP is very straight forward using the built in wrappers around TCPDF or DOMPDF (my preferred choice) First things, configure fuel to use pdf To generate a PDF with fuelPHP: [code] $data[‘quote’] = Model_Quote::find($id); $view = View::forge(‘quotes/print’, $data, false); $pdf = Pdf::factory(‘dompdf’)->init(); $pdf->set_paper(‘A4’); $pdf->load_html($view); $pdf->render(); [/code] In View file, in views/quotes/print is […]


Sending Email with fuelPHP

Sending email with fuelPHP is really straight forward, as are most things with fuel! In this example i am sending a quote to a client and attaching a PDF: [code] $email = \Email::forge(); $email->to($data[‘quote’]->client->email, $data[‘quote’]->client->name); $email->subject(‘New Quote from ‘ .$data[‘quote’]->user->username); $email->html_body(\View::forge(’email/quotetoclient’, $data)); $email->from(‘’, ‘Stuart’); $view = View::forge(‘quotes/print’, $data, false); $pdf = Pdf::factory(‘dompdf’)->init(); $pdf->set_paper(‘A4’); $pdf->load_html($view); $pdf->render(); […]


Using OIL in fuelPHP

Using OIL to generate Models, Controllers, Views, or even entire Scaffolding. A few notes. Quickly generate a model for albums: [code] oil generate model albums title:string description:text released:date image:string [/code] A Model for tracks… [code] oil generate model tracks title:string description:text album_id:int [/code] Generate Entire Scaffolding Generate a complete CRUD interface for albums: [code] oil […]


Google Map Corrupted Controls in Twitter Bootstrap Modal

As the rather lengthy title says, Google Maps controls get “corrupted” when showing a Google Map in a Twitter Bootstrap Modal, see my screenshot below: A Simple Fix #mapCanvas img { max-width:none; } This fix works simply by undoing the max-width:100% set on images by bootstrap default css. Setting max-width:none gives us normal controls again. […]


451 4.7.1 Service unavailable – try again later

  • May 19, 2013
  • Plesk

Good old Plesk. After an update yesterday, the Plesk milter greylisting has been confused, and returning 451 4.7.1 Service unavailable – try again later for all mail. Disabling grey listing within Plesk has at least allowed mail to now be delivered while i investigate, though no doubt Parallels will have a fix in the next […]


css columns in chrome

  • May 17, 2013
  • CSS

Chrome has different defaults to the other browsers it seems, and it breaks elements mid-way, whereas the other browsers will not break mid-element. so, a proprietary prefix fix: [code]-webkit-column-break-inside:avoid;[/code] will make Chrome behave like the rest (which personally i like as a default)


rsync for migrating websites

Using rsync to migrate websites to new servers. How to copy files to a remote server and keep symlinks in place, using rsync (instead of cp or scp) Useful rsync switches [code] -v verbose -q quiet -a archive -r recursive -d directories without recursion -g preserve group -o preserve owner -t preserve times -z compress […]


Custom Dropdown in CKEditor 4

Need a custom dropdown in CKEditor 4? I’ve created this plugin, you can download strInsert from the


Weighted search results using MySQL LIKE

  • May 7, 2013
  • MySQL

Using LIKE, instead of the usual MATCH AGAINST using FULLTEXT. Here’s the query i’ve made to search events: [code] SELECT id, title, date_from, IF (`title` LIKE ‘%$searchTerm%’, 20, IF (`content` LIKE ‘%$searchTerm%’, 10, 0)) + IF (`content` LIKE ‘%$searchTerm%’, 10, 0) + IF (`venue_name` LIKE ‘%$searchTerm%’, 5, 0) + IF (`venue_address` LIKE ‘%$searchTerm%’, 5, 0) […]