Within every Centeno-based application is a Values object. Many config.php files I’ve seen require that you then include the file into every page in the application. I’ll be looking through the code and find $someVar
and I look through and I’m thinking “where the heck is this coming from?”
The Values object is a PHP class that can be used in any page. First, make the Values file in this naming pattern- data.appname.Values.class.php
. Then, on a page that needs it, include_once("data.appname.Values.class.php");
. When you need a Value, type Values::getYourValue();
to get the value you need.
Let’s take a look at a sample Values class:
class Values { var $emailServer = "mail.yourdomain.com"; function getEmailServer() { $v = new Values(); return $v->emailServer; } }
Basically, at the top you establish class variables for everything you need. Then you make a method for each one (there may be some that you need to combine into a named (associative) array). Note that it works by instantiating the Values object and returning the variable for each value. I am not crazy. I will work on improving this methodology, but Centeno is intended to be easily maintainable and simple to use for developers. Performance comes second. I would rather by a beefier server than have to figure out what the heck I was doing for an hour every time a client asks me to extend the application.