Venkata Krishna
Venkata Krishna

Reputation: 4305

How to call a function which is outside of CodeIgniter application in Controller?

Hi I have a doubt about how to call a function which is defined in normal core php file. Now i want to call this function in controller of Codeigniter application.

What i mean is for example there is a function named with getdetails() in test.php in some directory. Now there is a codeIgniter application which has controller email.php.

Now i want to call getdetails() function in email.php.

Can anyone help me with some ideas.

Upvotes: 1

Views: 2105

Answers (2)

Jeff B.
Jeff B.

Reputation: 1167

Build your own helper, save this as test_helper.php in your application helpers folder:

function getdetails($paramater1, $parameter2){
    echo "test";
}

Then load it within your controller:

$this->load->helper('test');

And you can use it as this everywhere it's loaded:

getdetails();

Upvotes: 4

ars265
ars265

Reputation: 1987

You merely need to include the file before attempting to call the function. include or include_once

Upvotes: -2

Related Questions