0

i have library in file Example.php. I would like this include for action.class.php. How can i make this? In template i can make partial and use include_partial, but how can make somethings in action?

Nick Huge
  • 155
  • 1
  • 3
  • 9
  • take a look [here](http://stackoverflow.com/questions/5212649/how-to-create-use-custom-classes-and-helper-in-symfony-1-4/5217161#5217161) – tttony Sep 21 '11 at 00:44

1 Answers1

0

An easy - and symfony like - way would be to make a class file and store it in the lib directory, so the symfony autoloader will provide them all over your project.

Example.class.php :

Class Example {
    static public function myFoo(){
        return true;
    }
}

actions.class.php :

public function executeFoo($request){
    /* snip */
    $this->foo = Example::myFoo();
    /* snip */
}
domi27
  • 6,903
  • 2
  • 21
  • 33