now php1 and php2 both create objects of class1, however it is important for object class1 to know the path of 'templates'. this is being used in my templating system, by default the template dir is the dir of class1.php , so when i want to use a template i have to give the relative directory (for a template used by module1 for example i would have to say '../modules/module1/templates/***TEMPLATEFILE***' ) ... i can do that but its kind of messy, what i would like to do is when i create a class1 object for it to construct knowning the dir to my templates folder for that module. so in the constuctor for class1 it would be useful for it to know the directory which contains the calling function.-root
-->core/
---->class1.php
-->modules/
---->module1/
-------->php1.php
-------->templates/
---------->template1.htm
---->module2/
-------->php2.php
-------->templates/
i have come up with a temporary solution which supplies an optional argument to the class1 constructor. so if i said something like
Code: Select all
$obj = new class1('module1');this works better then having to supply a full relative path from class1 but is still cumbersome. what i would really like is to be able to say
Code: Select all
$obj = new class1();can anyone think of a way of doing that, i might just be stuck doing what im doing now but thought i would ask
thanks for your replies/thought