Forum Moderators: coopster
I am about to embark on a very PHP intensive site, and much of the code will be nothing to do with outputing any HTML, so I'd like to abstract the PHP as much as possible from both the xhtml & css.
Any thoughts on management of all this would be appreciated, and also if there is anyway to protect my code?
Cheers,
Regarding protecting code there is a product from a company called IONCube that will compile PHP. Also you have the Zend commercial tools that will do much the same. Zend may be a little more trusted since they make the PHP engine but their price tag is higher.
daisho
For example, my database library is included with:
require("/phplib/db/db.inc");
Misc. HTML functions are included with
require("/phplib/html/html.inc");
etc. etc.
By only including libraries on pages that require that functionality (much like #include within C programs) you keep the total code size down to a minimum for each page.
I doubt that this provides "protection" in the way you mean - but at least it would prevent critical code being served as raw PHP if, for example, a sysadmin upgraded your web server and messed up the CGI handling config!
That looks like a call for a templating system. There are quite a few ones available. Personally I think its mostly a matter of taste. I'd go with Smarty, though.
As far as protection: From whom do you want to protect the code?
@dmorison: Using include-files, and putting them outside is a very good idea. I can only agree to it! It will also lessen the chance of somebody trying to "fiddle" with your site by trying to make use of uninitialized variables (although, usually register globals is off anyhow, nowadays...)
As far as protection: From whom do you want to protect the code?
Err... that'll be the end users and the company it's being written for - I don't trust either of them much ;)
thanks
asp
Err... that'll be the end users and the company it's being written for - I don't trust either of them much ;)
You should have a look at this - it might be worth your investment if protecting your PHP Intellectual Property is a requirement:
[zend.com...]
Zend are intrinsically linked with PHP so I think i'm safe posting that here!