Jump to content

Why use .class.php instead .php?


Jessica

Recommended Posts

I name my classes xxx.cls.php and if yyy extends or xxx, xxx_yyy.cls.php just the naming convention I use (helps with the __autoload I use).

 

Hope we are all on php 5 and using the __autoload function (which I think is the best function ever added to php!) save syou so much time and ensures you don't go including all kind of rubbish you don't need.

Link to comment
Share on other sites

my naming conventions are like this for the same reason ToonMariner suggested - autoload.

 

I have a 'libs' directory, typical files like:

 

class.mysql.php - class called 'mysql'

base.component.php - class called 'component' but generally a base/abstract class rather than one that should be used alone.

funcs.general.php - general functions

funcs.math.php - just as it says.

 

it generally just means shaving time off actually finding stuff as well as allowing more automation when including relevent files.

Link to comment
Share on other sites

As people have touched on earlier, I believe the postfix .class.php is applied to avoid confusion when using the __autoload magic function.  Just a guess.  But say I used display php pages parallel to classes then the confusion would arise when I have members.php and members.php; the former being a page that displays the members using the members class to works with a DAO to return all necessary information.  Think of phpBB they do something.. similar.. however they separate their classes, well, includes, with a folder.  So meh.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.