23-04-2008, 17:00
|
#2 (permalink)
|
|
Junkie[scum]
Join Date: Oct 2006
Location: location, location
Posts: 1,647
|
no-one?
basically i'm looking to translate the following php code into some sort of ruby shit
PHP Code:
<?php
// Find include and base directory
if(DIRECTORY_SEPARATOR == '\\') {
$fullpath = str_replace("\\", "/", __FILE__);
} else {
$fullpath = __FILE__;
}
$breadcrumb = explode("/", $fullpath);
$filename = end($breadcrumb);
$includes = substr($fullpath, 0, (-1 * strlen($filename)));
$temp = strlen(prev($breadcrumb))+1;
$base = substr($fullpath, strlen($_SERVER['DOCUMENT_ROOT']), (0 * strlen($filename) - $temp));
unset($temp);
$directory['base'] = substr($fullpath, strlen($_SERVER['DOCUMENT_ROOT']), (0 * strlen($filename) - $temp));
$directory['include'] = substr($fullpath, 0, (-1 * strlen($filename)));
$directory['images'] = $directory['base']."images/";
$directory['css'] = $directory['base']."css/";
$directory['script'] = $directory['base']."js/";
?>
or do any of you rails cats know a method which is already embedded in the framework?
|
|
|
|