Advertisement
Guest User

Untitled

a guest
Feb 16th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. function root_require($file, $ir, $templates = FALSE){
  2.     $path = ROOT . SLSH;
  3.     switch($templates){
  4.         case 'admin':
  5.             $path .= 'templates' . SLSH . 'admin';
  6.             break;
  7.         case 'page':
  8.             $path .= 'templates' . SLSH . 'page';
  9.             break;
  10.         default:
  11.             $path .= 'include';
  12.             break;
  13.     }
  14.     $path .= SLSH . $file;
  15.     if (is_readable( $path )){
  16.         switch ($ir){
  17.             case 'i':
  18.                 include $path;
  19.                 break;
  20.             case 'io':
  21.                 include_once $path;
  22.                 break;
  23.             case 'ro':
  24.                 require_once $path;
  25.                 break;
  26.             case 'r':
  27.             default:
  28.                 require $path;
  29.                 break;
  30.         }
  31.     } else{
  32.         trigger_error('Tried to include a file that does not exist: ' . $path, E_USER_NOTICE);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement