class calling script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux