RSS - Latest posts Posts Tagged ‘php’

Home » Tags » php
13Apr
2009

Regex for Autolinking URLs

For a recent project I was wanting to perform an exceptionally common task. Converting things that look like URLs in the text into clickable links. However wherever I’ve seen this implemented before I’ve always encountered the same annoying problem, namely the links break when the user types a URL and adds some punctuation at the end since the punctuation gets captured as part of the link.

(more…)

Categories:

17Feb
2009

Zend Framework Decorators - Labels and Checkboxes

Very often it is the smallest things that annoy us the most. It took me a while to figure out why the placement parameter was not changing anything. I started of with the following:

'decorators' => array(
	array('Label'),
	array('ViewHelper')
)

(more…)

Categories:

14Oct
2008

How to convert PDT projects into PHPEclipse projects

If for some reason you decide to swap from one Eclipse based PHP IDE to another, rather than recreate the projects you can change their association, so that the project builders work correctly.

This is basically what you need to do if you get the following error when trying to ctrl clicka function:

“The resource is not on the build path of a PHP project”

To convert to a PHPEclipse compatible project you basically need to replace the buildSpec and natures sections of the .project file with the following:

<buildSpec>
	<buildCommand>
		<name>net.sourceforge.phpeclipse.parserbuilder</name>
		<arguments>
		</arguments>
	</buildCommand>
</buildSpec>
<natures>
	<nature>net.sourceforge.phpeclipse.phpnature</nature>
</natures>

If you need to convert the other way, or to something else, simply grab the appropriate section from a working project and paste it into the .project file you need to fix.

Categories:

24Sep
2008

How to use special characters in FPDF

FPDF is a nice little library for php that allows you to create PDFs on the fly. It’s great for all sorts of document, amongs them invoices. Until you try to use say a pound (£) or euro (€) sign. Basically the library itself does not support utf-8, so the moment you need to insert anything extra into your document a conversion needs to be done.

To save you some searching and a masive panic attack here is the easy way to do it:

iconv("UTF-8", "ISO-8859-1", "£");

You could also use the same command to do the whole text rather than just the pound sign itself. Example below:
(more…)

Categories: