I have create lots of module for a cms-site .. with functions only.
to avoid the collision of the function names ... i have kept module name before the function names.

now i need to convert the modules to classes.

one module contains lots of files included ..

can we similarly include the multiple files for a class...??? ( i cant do this. please help)
just as ... one member function of a class in a separate file ...


any suggestion will be appreciated

can we similarly include the multiple files for a class...??? ( i cant do this. please help) just as ... one member function of a class in a separate file ...

I'm not sure if it's the best idea to just copy and paste a set of functions into a class. Doesn't quite live up to the most rigorous notions of OOP...

More to the point, I don't believe this is possible. I've attempted to do it a number of ways and none of them appear to work.

You can include a file within a function, but you can't include a file within a class declaration but outside of the declaration of a method.

So one thing you could do (I think) is declare the method in the class declaration and then include a file with the contents of that method.

However, your class should be in one, nice, self-contained file. If your class is too bloated for that, you should consider breaking it into sub-classes with inheritance to keep standard functionality across different sub-classes.

- Walkere

Thanks Walkere,

You made it easy....

now my first step is to covert them to classes as your idea..."including a file within a member function".

this way i will be able to move to php 5 easily .

thanks a lot ...

This article has been dead for over six months. Start a new discussion instead.