Hello, I would like to use a codeigniter library (codeigniter/system/libraries/Encrypt.php)
So in my template I have
$this->EE->load->library(‘ci_encrypt’); $encrypted_lbl = $this->encrypt->encode(“test”, ‘123’);
But I get the error message “Unable to load the requested class: ci_encrypt”
I also tried $this->EE->load->library(‘encrypt’); but I got “Undefined property: EE_Functions::$encrypt”
How can I use this library with expressionengine? thank you
You should probably be building a plugin actually. That way you could wrap your tags around the message and pass in an optional key:
{exp:bractar_encrypt key="123"}
test
{/exp:bractar_encrypt}Then within your plugin code, you can load the library and encode the tagdata:
$this->EE->load->library('ci_encrypt');
$tagdata = $this->EE->TMPL->tagdata;
// Get the key, if it's not there, set it to a blank string
$key = $this->EE->TMPL->fetch_param('key', '');
// Return the encrypted information
$this->return_data = $this->encrypt->encode($tagdata, $key);If you haven’t created a plugin before, take a look at the documentation and you might try using pkg.io to create the base plugin for you.
Wes
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.