static function display($request)
 {
     if (is_array($request)) {
     } else {
         $res = static_item_model::get_entry(intval($request));
         $row = $res->fetch(PDO::FETCH_ASSOC);
         $v = new static_item_frontend_view();
         foreach ($row as $key => $value) {
             switch ($key) {
                 case 'language':
                     $key = 'lang';
                     $value = substr($value, 0, 2);
                     // no break needed
                 // no break needed
                 default:
                     $v->assign_ref($key, $value);
             }
         }
         $v->assign('years', '2007 - 2010');
         $v->assign_ref('rel_path', rel_path($row['level']));
         $v->assign('stylesheet_url', 'all');
         $v->assign('l10n_search', 'Suche');
         $v->assign('info', NULL);
     }
     $v->loadTemplate();
 }
Beispiel #2
0
function abs_path($path)
{
    if (isset($path[0]) && $path[0] != '/') {
        return rel_path($path);
    }
    return $_SERVER['DOCUMENT_ROOT'] . $path;
}
Beispiel #3
0
<?php

// Execute on command line args
echo rel_path($argv[1], $argv[2]);
/**
 * Author: Santosh Patnaik
 * Original version: http://www.php.net/manual/en/function.realpath.php#77203
 * Original description:
 * Given real paths of two files, this function finds the relative path of one ($dest) with respect to the other ($root).
 * 
 * rel_path function to compute the relative path between two absolute paths.
 * Computes the path from root to dest.  For example:
 * rel_path('a/c', 'a/b') -> '../c'
 */
function rel_path($dest, $root = '', $dir_sep = '/')
{
    $root = explode($dir_sep, $root);
    $dest = explode($dir_sep, $dest);
    $path = '.';
    $fix = '';
    $diff = 0;
    for ($i = -1; ++$i < max($rC = count($root), $dC = count($dest));) {
        if (isset($root[$i]) and isset($dest[$i])) {
            if ($diff) {
                $path .= $dir_sep . '..';
                $fix .= $dir_sep . $dest[$i];
                continue;
            }
            if ($root[$i] != $dest[$i]) {
                $diff = 1;
                $path .= $dir_sep . '..';