class calling script

From: Date: Mon, 11 Apr 2005 01:08:47 +0000
Subject: class calling script
Groups: php.general 
Request: Send a blank email to php-general+get-212769@lists.php.net to get a copy of this message
Hi there, I have been testing a possible solution to reduce the ammount of interface calling scriptsto my class files. Currently each class has a calling script. I am thinking of setting up a url like /currentdir/packagename/classname, mind you this is only a test but is it a good or bad bad idea ?I have run into troubles getting get queries because its calling the classname in the query alreadyso /packagename/classname?test=1 doesnt work. I have also found that the javascript and stylesheets loaded as stylesheet/styler.css and javascript/some.js dont load because of the extra path in the name :| Is this efficient enough to work or isthere similar systems doing this around the place ? maps to a script testcall.php?packagename/classname RewriteEngine on RewriteCond %{REQUEST_URI} ^/([/A-Za-z0-9_]*)?([A-Za-z0-9_]+)$ RewriteRule ^(.+) testcall.php?$1 [L] the script then loads the file like $arr = preg_split("/\?/",$_SERVER['REQUEST_URI']); $key = array_keys($_GET); $arr = preg_split('/\\//',$key[0]); $package = ucfirst($arr[0]); $class = ucfirst($arr[1]); $filename = $package.'/'.$class.'.php'; $constructor = $package.'_'.$class; require_once ''.$filename.''; new $constructor;

« previous php.general (#212769) next »