Nathan Pitmanhello, my name is
nathan pitman.

ExpressionEngine Plug-in: Encode/Decode Jul 22. 084

Every time I come up against something which I once would have resorted to PHP to solve, I end up writing a little plug-in these days instead. It just feels less dirty that way…

Anyhow, this one was developed to help me out when I needed to pass a string of data from one page to another in the URL. The string in question would occasionally include a forward slash and as such the string would become split as Expression Engine interpreted it as two separate URL segments.

The ‘Encode/Decode’ plug-in takes any string of text and encodes or decodes it. Typical usage of the plug-in is as follows:

{exp:encode_decode style="base64" direction="encode"}{title}{/exp:encode_decode}

The plug-in offers ‘base64’ and ‘url’ encoding and decoding but it would be easy to add more options. For me base64 seems to work best.

Download ‘Encode/Decode’ from GitHub

Obviously let me know in the comments if you have any thoughts on how this can be improved. Enjoy!

Had to pull some data from a URL segment but needed it to be readable. This is just what I needed. Thanks!

Posted by Benek on 19/08/2010 at 10:00 PM

I’m using this, but I’m not able to convert “

Do you know how I can do this?

Posted by Adam on 16/02/2011 at 09:36 PM

Haha, that is I’m unable to convert & # 8 2 2 0 ; (without the spaces). :)

Posted by Adam on 16/02/2011 at 09:37 PM

@Adam, try the latest version which I just pushed up to GitHub! There were some errors in the previous version, I also added compatibility with EE2 and a more URL friendly base64 option (url_safe_base64).

Posted by Nathan Pitman on 03/08/2011 at 10:17 PM

Speak your mind

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below: