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}Sides, Soups, Salads{/exp:urlsafe}
Returns: sides-soups-salads
{exp:urlsafe reverse="yes"}sides_soups_salads{/exp:urlsafe}
Returns: Sides, Soups, Salads
{exp:urlsafe reverse="yes"}sides-soups-salads{/exp:urlsafe}
Returns: Sides Soups Salads
PARAMETERS: The tag has two (optional) parameters:
The download is now over at its designated page at masugadesign.com: http://www.masugadesign.com/the-lab/scripts/urlsafe/
This was put together really quickly for a project that, apparently, didn’t have any wacky characters going on in the Category titles. I think this plugin may be misnamed. All this was supposed to do was take already approved category names and make those quote-enquote “urlsafe”. If you can’t put an umlaut in an EE category name (can you? haven’t tried…), then this didn’t have to bother with it.
So, I think in the interest of this being usable for more than making category names into “url titles” more-or-less (like I said, I think this whole thing might be obsolete now…) it might need an update. I posted this because I thought it was something that might help davenport use category names in the URL as opposed to Cx.
Did this post even make sense? I’m so hungry I can’t think straight.
This was put together really quickly for a project that, apparently, didn’t have any wacky characters going on in the Category titles. I think this plugin may be misnamed.
Well, slightly misleading, perhaps … But I am sure we can have it live up to its name in no time.
If you can’t put an umlaut in an EE category name (can you? haven’t tried…), then this didn’t have to bother with it.
But you can, most definitely.
I’m so hungry I can’t think straight.
Me, too, actually. Off to get something between my teeth.
I wrote a little plug-in yesterday to encode/decode using url or base64…
http://nathanpitman.com/journal/547/expressionengine-plug-in-encodedecode
😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.