URLSafe

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

Download URLSafe 1.0.2 (2kb zip)

This version posted June 25, 2007

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 May 4, 2008.


No comments.

Leave a Reply

If you're entering a block of code, you can wrap it with [code][/code] for proper formatting.

A Labrador Retriever is a type of ___? 3 character(s)