own file with PHP functions

Hi

I have my own file with functions, and how can I include this file to my Controler?

Thanks :)

There is nothing special, a simple


include 'path/to/file';

should work.

I include my own php-functions (cause there are shortcuts for debugging) inside index.php

My shortcuts for common widget-calls are inside a static class which I import via the config

When I put this code in my index.php :


$funkc=dirname(__FILE__).'/functions.php';

require($funkc);

my JS code not working :(

Can you specify it a bit further, with some example code from your functions.php file?

example:


function policz_z ($zasoby,$okres,$przyrost,$magaz){

  for ($e = 0; $e<5; $e++) {

     $zasoby[$e] +=  $okres * $przyrost[$e]/3600;

      if ($zasoby[$e]>=$magaz[$e]){

         $zasoby[$e]=$magaz[$e];

      }

  }

  return $zasoby;

}

Take a look at this wiki.

You can use for any function, not only shortucts.

Ok, I thought that the non-working JS (supposing: javascript) code was generated by the included functions. Now I haven’t got any idea.

OK now it’s working I have another “include” in functions.php

SOLEVED Thanks

I used the import option in the config.


'import'	=> array('application.helpers.*')

Create a folder in the protected folder called "helpers" and put your static classes in there.


class Helper {

    public static function myHelperFunc() {


    }

}


Helper::myHelperFunc();