URLSafe

Makes a string "url safe", or the reverse.

Download URLSafe

This version posted June 25, 2007
Downloads: 137

Makes a string url safe. Or the reverse. I needed to use this for some friendly category names in a url a while back. With the release of EE 1.6, this might be obsolete, but hey, it might come in handy somewhere as well.

This is a pretty basic plugin. Underscores are replaced with a comma and a space, and hyphens are replaced with spaces.

Place the following tag in any of your templates:

{exp:urlsafe}SidesSoupsSalads{/exp:urlsafe}
Returns
sides-soups-salads

{exp
:urlsafe reverse="yes"}sides_soups_salads{/exp:urlsafe}
Returns
SidesSoupsSalads

{exp
:urlsafe reverse="yes"}sides-soups-salads{/exp:urlsafe}
Returns
Sides Soups Salads 

PARAMETERS

The tag has two (optional) parameters:

  1. separator: The replacement character [OPTIONAL, defaults to hyphen ‘-’]
  2. reverse: makes a url safe string in to a capitalized string [OPTIONAL]

View the related thread in the EE forums.

This entry was last updated January 11, 2009.


Sorry, comments are closed.