On Jan 8, 5:38 pm, "Larry E. Masters aka PhpNut" <[EMAIL PROTECTED]>
wrote:
Nothing is stopping you from adding code to your bootstrap.php or vendors
directory and writing the code yourself to perform this task.

Hi All I mocked up and tested the following app/bootstrap file:

****************************
<?php
/* Define Paths relative to root. Example uses the following Folder
structure:
Root
        app
                config
                        bootstrap.php <- this file
        cake
        vendors
        import
                controllers
                        example_controller.php
                models
                        example.php
                views
                        example
                                index.thtml
                webroot
                        js
                        css
                                example.css
*/
$controllerPaths = array(ROOT.DS.'import'.DS.'controllers'.DS);
$componentPaths =
array(ROOT.DS.'import'.DS.'controllers'.DS.'components'.DS);
$modelPaths = array(ROOT.DS.'import'.DS.'models'.DS);
$viewPaths = array(ROOT.DS.'import'.DS.'views'.DS);
$helperPaths = array(ROOT.DS.'import'.DS.'views'.DS.'helpers'.DS);
$webPaths = array(ROOT.DS.'import'.DS.'webroot'.DS);

$folders = array('js' => 'text/javascript', 'css' => 'text/css');
$requestPath = explode('/', $_GET['url']);
if (in_array($requestPath[0], array_keys($folders))) {
        $requestType = $requestPath[0]; // css or js
        $requestFolder = $requestPath[1]; // if the url is
/css/import/example.css, this is 'css'
        array_shift($requestPath); // remove the first two array items
        array_shift($requestPath);
        foreach ($webPaths as $webPath) {
                $explodedPath = explode(DS, $webPath);
                $webPathName = $explodedPath[count($explodedPath)-3];
                $file = $webPath . $requestType . DS . join(DS, $requestPath);
                if ((low($requestFolder) == low($webPathName)) &&
(file_exists($file))) {
                        header('Content-type: ' . $folders[$requestType]);
                        include ($file);
                        exit();
                }
        }
}
?>

*******************************
In exactly the same way, I guess it could be made to work to server
plugin js/css files - any comments?

HTH,

AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :) You may get your answer quicker by asking on
the IRC Channel (you can access it with just a browser
here:http://irc.cakephp.org).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to