J. Cornelius

Smarty Widgets

March 15, 2006

PHP and Smarty Search Bookmarklets

Do you ever want a quick way to search PHP or Smarty Documentation for a function? Here it is! Just drag this link to your browsers bookmarks (or links) toolbar and voila!

Modifiers to Make Life Easier

These simple Smarty modifiers have made life easier for me. The use them just save the source code file, change the extension from .phps to .php, and put it in your Smarty plugins folder.

Smarty Country Select Drop Down

Coding Country select boxes can be a pain. This plugin uses the built-in html_options function in Smarty to return a html select box populated with ISO Country Codes and Names. It also allows for specification of a custom default country selection (So Canada can be your default if you live there).

Get the Source

Smarty State Select Drop Down

Same as above but returns a html select box populated with US States and Canadian Provinces.

Get the Source

Smarty Acronym Definer Output Modifier

This is based on Matt Mullenweg's PHP Acronym Definer which will define all the acronyms it can using the acronym tag for any text you run through it. Just drop it in your Smarty plugins directory and register it. Then call it in your Smarty templates like this: {$your_text|acronymit}

Get The Source

Smarty Widont Modifier

Widonts are a typographical no-no, and people all over the Web can tell you why. Fortunately, fixing them is very easy. One line of PHP can handle the chore:

preg_replace('|([^\s])\s+([^\s]+)\s*$|', '$1 $2', $string);

The issue is a clean, reusable way to access that function. Rather than add this to all your titles, headings, paragraphs, etc in your application code (where it really doesn't belong), just use this simple Smarty Modifier to do the trick. Once installed in your plugins directory you can just call it and automagically fix any problems.

{$your_text|widont}

Get The Source

Was it good for you?

Post to Digg Post to del.icio.us Post to ma.gnolia Post to Furl Post to Mixx

Tags

design, development, html, php, smarty

About

J Cornelius is a software developer, Web developer, and Formula 1 fan in Atlanta GA. He has a strange affinity for odd numbers, european sports cars, thoughtful analogies, and is hopelessly addicted to chips & salsa. Read more

Recent Articles