Welcome Guest, Not a member yet? Register   Sign In
Define/include "globally available" arrays and functions
#8

(This post was last modified: 06-06-2021, 05:52 AM by paulbalandan.)

You can use the new Files autoloading available to the Autoloader as of v4.1.2. Create a class containing your global functions and defining your currencies as constant.

PHP Code:
// example filename: my_global_functions.php

define('CURRENCIES', array('EUR''USD'));

if (! 
function_exists('foo'))
{
    function foo()
    {
            // logic here
    }


After creating the file, write the path of the file in your app/Config/Autoload.php file, particularly in the $files property.

PHP Code:
// app/Config/Autoload.php

public $files = [
    'path/to/my_global_functions.php',
]; 
Reply


Messages In This Thread
RE: Define/include "globally available" arrays and functions - by paulbalandan - 06-06-2021, 03:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB