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

Adding Custom Functions Class

Development and Programming

mark186282's avatar
mark186282
290 posts
13 years ago
mark186282's avatar mark186282

Not a critical issue, just looking for a little input.

I use the Functions Class quite a bit: http://ellislab.com/expressionengine/user-guide/development/reference/functions.html

And I’m looking for creating my own similar class for functions I use in different things in different places (for example, a function for creating a specifically crafted random password)

Where could I place the functions file such that it could be loaded similar to the functions class:

$memberlist_url = $this->EE->functions->create_url('member/memberlist');
       
Bhashkar Yadav's avatar
Bhashkar Yadav
727 posts
13 years ago
Bhashkar Yadav's avatar Bhashkar Yadav

it would be better if you create your own library by following the ways as : - create you library file into system\expressionengine\libraries. follow the convention, first letter of file name should be in upper case

  • in this library file create class preceding with EE_ with file name like
class class EE_Mylibrary
{
}
  • you can use your library functions by loading it like :
$this->EE->load->library('Mylibrary');
/* let you have created library file named Mylibrary.php */
/* Call your function */
$this->EE->mylibrary->your_function();

hope this would you.

Best Regards,

       
mark186282's avatar
mark186282
290 posts
13 years ago
mark186282's avatar mark186282

Perfect - thank you very much!

       

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.