phpDocumentor PHPShopClass
[ class tree: PHPShopClass ] [ all elements ]

Source for file nav.class.php

Documentation is available at nav.class.php

  1. <?php
  2. /**
  3.  * Библиотека навигации
  4.  * @author PHPShop Software
  5.  * @version 1.2
  6.  * @package PHPShopClass
  7.  */
  8. class PHPShopNav {
  9.     /**
  10.      * @var array массив данных навигации 
  11.      */
  12.     var $objNav;
  13.     
  14.     /**
  15.      * Конструктор
  16.      */
  17.     function PHPShopNav({
  18.         $url=parse_url("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
  19.         
  20.         // Вырезаем, если в папке
  21.         $path_parts pathinfo($_SERVER['PHP_SELF']);
  22.         $root$path_parts['dirname']."/";
  23.         if($root!="//")
  24.             if($root!="\/"$url=str_replace($path_parts['dirname']."/","/",$url);
  25.         
  26.         $Url=$url["path"];
  27.         $Query=$url["query"];
  28.         $Path=explode("/",$url["path"]);
  29.         $File=explode("_",$Path[2]);
  30.         $Prifix=explode(".",$File[1]);
  31.         $Name=explode(".",$File[0]);
  32.         $Page=explode(".",$File[2]);
  33.         $QueryArray=parse_str($Query,$output);
  34.         $longpage=explode(".",str_replace("/page/","",$url["path"]));
  35.         
  36.         // Заглушка для index
  37.         if(empty($Path[1]or strpos($Path[1],'.html')) $Path[1]='index';
  38.         
  39.         $this->objNav=array(
  40.                 "truepath"=>$url["path"],
  41.                 "path"=>$Path[1],
  42.                 "nav"=>$File[0],
  43.                 "name"=>$Name[0],
  44.                 "id"=>$Prifix[0],
  45.                 "page"=>$Page[0],
  46.                 "querystring"=>$url["query"],
  47.                 "query"=>$output,
  48.                 "longname"=>$longpage[0],
  49.                 "url"=>$url["path"]);
  50.         $GLOBALS['SysValue']['nav']=$this->objNav;
  51.     }
  52.     
  53.     /**
  54.      * Выдача переменной навигации path
  55.      * @return string
  56.      */
  57.     function getPath({
  58.         return $this->objNav['path'];
  59.     }
  60.     /**
  61.      * Выдача переменной навигации nav
  62.      * @return string 
  63.      */
  64.     function getNav({
  65.         return $this->objNav['nav'];
  66.     }
  67.     /**
  68.      * Выдача переменной навигации name
  69.      * @return string 
  70.      */
  71.     function getName($mod_replace='/'{
  72.         return str_replace($mod_replace,'',$this->objNav['longname']);
  73.     }
  74.     /**
  75.      * Выдача переменной навигации id
  76.      * @return string 
  77.      */
  78.     function getId({
  79.         return $this->objNav['id'];
  80.     }
  81.     
  82.     /**
  83.      * Проверка на главную страницу
  84.      * @return bool
  85.      */
  86.     function index({
  87.         if($this->objNav['path']=='index'return true;
  88.     }
  89. }
  90. ?>

Documentation generated on Mon, 25 Jun 2012 15:09:49 +0400 by phpDocumentor 1.4.3