Welcome Guest, Not a member yet? Register   Sign In
How to call a library function from within a model?
#4

[eluser]InsiteFX[/eluser]
Why not just create a helper for it? Say utility_helper.php
Then all you need to do is load the helper not a complete library.
Code:
if ( ! function_exists('make_uri_title'))
{
    function make_uri_title($name)
    {
        $items = array('/\ /', '/\-/');
        return preg_replace($items, '_', strtolower($name));
    }
}

Not only that now you can add other functions to your helper as needed.

If you need to get to CI you can do this in a helper function:
Code:
// get the CI Superobject.
$CI =& get_instance();

InsiteFX


Messages In This Thread
How to call a library function from within a model? - by El Forum - 03-10-2011, 09:35 AM
How to call a library function from within a model? - by El Forum - 03-10-2011, 11:40 AM
How to call a library function from within a model? - by El Forum - 03-10-2011, 11:50 AM
How to call a library function from within a model? - by El Forum - 03-10-2011, 02:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB