Posted by giacomo.galilei on 09/25/06 20:55
> You can get the directory of the class script from inside the class
> using dirname(__FILE__).
>
> i.e.:
>
> == obj/foo/class.foo.php ==
>
> <?php
>
> class Foo
> {
> function bar()
> {
> // Load resources
> file_get_contents(dirname(__FILE__) . "/stuff.txt");
> }
> }
>
> ?>
>
> This will load the file obj/foo/stuff.txt, and does not matter when or
> from where Foo::bar() is called.
>
yes, it's easier and simple at the same time.. thank you
Bye
Navigation:
[Reply to this message]
|