We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Load a codeigniter library

Development and Programming

bractar's avatar
bractar
1 posts
14 years ago
bractar's avatar bractar

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

       
Wes Baker's avatar
Wes Baker
343 posts
14 years ago
Wes Baker's avatar Wes Baker

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.