Re: [Phpslash-devel] How many page scripts do we need?
Brought to you by:
joestewart,
nhruby
From: Matthew L. <lei...@ma...> - 2003-04-29 19:33:01
|
Hey, Still thinking about this... nathan r. hruby wrote: >>I don't understand why this needs to be an object. It'll get used >>everywhere, it's probably best in functions.inc and let the individual >>classes manage the storage of the variables. >> > > > To expand.. > > if it's an object that's needed, much of this framework lays already in > phplib session object, which we can expand from, if an object is *truly* > desired. Again, I htink that having this in the globall scope would > probably be easier and faster in the long run. I don't think URLs should stay in the templates because then changing GET variable names means having to change the templates and that seems like a breach of the design/logic barrier. I still think a class is the best way to allow different implementations of the URL, or just to have all in one place the functions which put it together. Perhaps global wrapper functions could be used for the most common url creation methods for coding ease. > // Set the inital URL we want > $url = '/foo.php'; > > // thake this and bring back an array of everything we need to develop a > // URI for what we want to ppoint at > $url = urlAddQuery($url, array('foo' => 'bar', 'session' => $sessid)); > > // it should look somehting like this. > print_r($url); > // Array( > // [method] => $_PSL['protocol'] > // [base] => $_PSL['rooturl'] > // [file] => /foo.php > // [args] => Array( > // [foo] => bar > // [session] => fjiweqcn ujnjrinu290vncu034vn u390vntu13 > // ) > //) > > // take that array and push it though a function to turn it into a URI > $tpl->add_var('URL', urlFinish($url)); But if you want to add other GET variables conditionally, you'll have to manipulate $url['args']. What about removing a GET variable? Even uglier. It just naturally looks like members and methods to me. > Easier to grok, less creation/teardown costs, etc.. (I've been working on > another project that's wacked out but all procudural using jsut > include_once() to seperate code. It's a mess to navigate and use, but > it's freakin' *fast* so my new thing is to look for places where we can > reduce/reuse existing structures or at least avoid introduccing new stuff. > :) Is the procedural model definitely faster than OO? We already use lots of classes. If we're reorganizing the whole project architecture then I think introducing new stuff is not a bad idea after all. --Matt -- ---------------------------------------------------------------- Matthew Leingang http://www.math.rutgers.edu/~leingang Rutgers University lei...@ma... Department of Mathematics "This signature needs no quote." |