I have a web app with a lot of files that I call via jQuery. My main scripts reside in the top-level directory, and my ajax scripts reside in /ajax.
Most of the AJAX scripts I write tend to have a single function, and so I name them appropriately (i.e. add_user.php, process_cc_payment.php). But depending on what I'm doing with it, they tend to vary wildly and there's no rhyme or reason to their names. Is there a standard practice for this?
Naming ConventionsVariable and function names written as camelCase. Global variables written in UPPERCASE (We don't, but it's quite common) Constants (like PI) written in UPPERCASE.
There no single standard practice for this, just follow some basic rules (your rules that you and your team follow, this is my general list):
payment_xxxx.php
, again do what works for you hereI would recommend you to organize the methods and put it together.Ex: Have a file for all methods of user (add user,update user,get user,delete user etc..) Use querystring values to discriminate which function to be called.I usually add a handler suffix to the file names and keep it under the handler folder under my Library(Lib) folder
Lib\handlers\userhandler.php
Lib\handlers\coursehandler.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With