|
|
Choosing A Webhost: |
Re: How many page scripts do we need?: msg#00028cms.phpslash.devel
On Mon, 28 Apr 2003, nathan r. hruby wrote: [snip] > > > > I've been thinking about something for a long time, and this looks like > > a good time to bring it up. What about getting all URLs out of the > > templates and objectifying them? A url object would be able to parse > > $QUERY_STRING and/or $PATH_INFO and decode it. It would also have a > > toString method which output would go into the templates. > > > > $url = new PslUrl(); > > $url->setPath("/index.php"); > > $url->setVar("foo","bar"); > > $url->toString() // returns index.php?foo=bar, > > [snip] > > 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. // 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)); 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. :) I belive that at one point we had talked about moving all URL generation into $sess->url calls but felt that was a large undertaking for not a lot of benifit. This may be something we want to re-evaluate now that there are motiviations other than session propigation for rewriting url's in a predefined manner. -n -- ------ nathan hruby nathan-MSHXTcNGJzS8rjiVs5Nzzw@xxxxxxxxxxxxxxxx ------ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How many page scripts do we need?, nathan r. hruby |
|---|---|
| Next by Date: | Re: How many page scripts do we need?, Matthew Leingang |
| Previous by Thread: | Re: How many page scripts do we need?, nathan r. hruby |
| Next by Thread: | Re: How many page scripts do we need?, Matthew Leingang |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |