GabaritTemplate Class Reference

Adjust conportement for master construct public page This class it's basic load for osCSS It's possible add new class for modifie process and determine conportement this master class constructor. More...

Inherits page.

List of all members.

Static Protected Member Functions


Detailed Description

Adjust conportement for master construct public page This class it's basic load for osCSS It's possible add new class for modifie process and determine conportement this master class constructor.

Definition at line 16 of file GabaritTemplate.php.


Member Function Documentation

GabaritTemplate::GetFooter (  )  [static, protected]

choose file for include

Definition at line 172 of file GabaritTemplate.php.

00172                                        {
00173     global $page;
00174     return $page->getPathTemplate().'footer.php';
00175   }

GabaritTemplate::GetGabaritTemplate (  )  [static, protected]

traite le nom de la page pour determine le gabarit utilisé

  • -> template/products_info.(type produit).php (ex product_info.type_1)
  • -> template/template.(type produit).php (ex product_info.type_1)
  • -> template/nom_page.(cpath or product_id).php (ex product_info.p_12)
  • -> template/template.(cpath or product_id).php
  • -> template/nom_page.php
  • -> template/type.nom_page.(cpath or product_id).php
  • -> template/type.nom_page.php
  • -> template/type.template.(cpath or product_id).php
  • -> template/type.template.php
  • -> template/template.php NOTE: Si cptah vide, alors cherche suffixe error
    Parameters:
    [out] $this page[type] determine la class de gabarit.
    [out] $this page[content]
    Returns:
    retour du nom du template

Definition at line 38 of file GabaritTemplate.php.

00038                                                  {
00039     global $page;
00040     if(isset(parent::$GlobalCache['gabarit'])) return $page->page['gabarit']=parent::$GlobalCache['gabarit'];
00041 
00042     $format_file="%1\$s.%2\$s.php";
00043     $path = $page->getPathTemplate();
00044 
00045     switch($page->page['type']){
00046       case 'product':
00047         if (empty($page->page['var']['product_info']['products_id'])) $suffixe='error';
00048         else $suffixe='p_'.$page->page['var']['product_info']['products_id'];
00049       break;
00050       case 'listing':
00051       case 'listing_cat':
00052         if (!tep_not_null($page->page['var']['cPath'])) $suffixe='error';
00053         else {
00054           if(strpos($page->page['var']['cPath'],'_')!=false)
00055             $suffixe='c_'.substr($page->page['var']['cPath'], 0, strpos($page->page['var']['cPath'],'_')).'.childs';
00056           else
00057             $suffixe='c_'.$page->page['var']['cPath'];
00058         }
00059       break;
00060     }
00061     $p_red=substr($page->page['content'],0,-4);
00062     if (isset($_GET['popup']) && parent::TestFile($path.'popup.php') )
00063       $page->page['gabarit']='popup.php';
00064     // type products
00065     elseif($page->page['type']=='product' && parent::TestFile($path.sprintf($format_file,$p_red,'type_'.$page->page['var']['product_info']['type'])) )
00066       $page->page['gabarit']=sprintf($format_file,$p_red,'type_'.$page->page['var']['product_info']['type']);
00067     elseif($page->page['type']=='product' && parent::TestFile($path.sprintf($format_file,'template','type_'.$page->page['var']['product_info']['type'])) )
00068       $page->page['gabarit']=sprintf($format_file,'template','type_'.$page->page['var']['product_info']['type']);
00069     //page
00070     elseif(isset($suffixe) && parent::TestFile($path.sprintf($format_file,$p_red,$suffixe)) )
00071       $page->page['gabarit']=sprintf($format_file,$p_red,$suffixe);
00072     elseif(isset($suffixe) && parent::TestFile($path.sprintf($format_file,'template',$suffixe)) )
00073       $page->page['gabarit']=sprintf($format_file,'template',$suffixe) ;
00074     elseif(parent::TestFile($path.$page->page['content']))
00075       $page->page['gabarit']=$page->page['content'] ;
00076     // class
00077     elseif(isset($suffixe) && parent::TestFile($path.$page->page['class'].'.'.sprintf($format_file,$p_red,$suffixe) ))
00078         $page->page['gabarit']=$page->page['class'].'.'.sprintf($format_file,$p_red,$suffixe) ;
00079     elseif(parent::TestFile($path.$page->page['class'].'.'.$page->page['content'] ))
00080       $page->page['gabarit']=$page->page['class'].'.'.$page->page['content'] ;
00081     elseif(isset($suffixe) && parent::TestFile($path.$page->page['class'].'.'.sprintf($format_file,'template',$suffixe) ))
00082       $page->page['gabarit']=$page->page['class'].'.'.sprintf($format_file,'template',$suffixe) ;
00083     elseif(parent::TestFile($path.$page->page['class'].'.'.'template.php' ))
00084       $page->page['gabarit']=$page->page['class'].'.'.'template.php' ;
00085     // type
00086     elseif(isset($suffixe) && parent::TestFile($path.$page->page['type'].'.'.sprintf($format_file,$p_red,$suffixe) ))
00087         $page->page['gabarit']=$page->page['type'].'.'.sprintf($format_file,$p_red,$suffixe) ;
00088     elseif(parent::TestFile($path.$page->page['type'].'.'.$page->page['content'] ))
00089       $page->page['gabarit']=$page->page['type'].'.'.$page->page['content'] ;
00090     elseif(isset($suffixe) && parent::TestFile($path.$page->page['type'].'.'.sprintf($format_file,'template',$suffixe) ))
00091       $page->page['gabarit']=$page->page['type'].'.'.sprintf($format_file,'template',$suffixe) ;
00092     elseif(parent::TestFile($path.$page->page['type'].'.'.'template.php' ))
00093       $page->page['gabarit']=$page->page['type'].'.'.'template.php' ;
00094     // base
00095         elseif(parent::TestFile($path  .'template.php'))
00096         $page->page['gabarit']='template.php';
00097     else die(__('object page (lg '.__LINE__.') FATAL ERROR: the gabarit template not found!'));
00098 
00099     parent::$GlobalCache['gabarit']=$page->page['gabarit'];
00100   }

static GabaritTemplate::GetHeader (  )  [static, protected]

Definition at line 181 of file GabaritTemplate.php.

00181                                        {
00182     global $page;
00183     return $page->getPathTemplate().'header.php';
00184   }

GabaritTemplate::GetInit (  )  [static, protected]

choose file for include

Definition at line 190 of file GabaritTemplate.php.

00190                                      {
00191     global $page;
00192     return $page->getPathTemplate().'cfg/init.php';
00193   }

GabaritTemplate::GetPageContent (  )  [static, protected]

Scan template content folders and display template content if exist, if not display default oscss content.

Definition at line 156 of file GabaritTemplate.php.

00156                                              {
00157     global $page;
00158 
00159     $filename = $page->getPathTemplate() . '/includes/content/'. $page->page['content'];
00160 
00161     if (parent::TestFile($filename)) $page->page['path_content'] = (DIR_WS_TEMPLATES . $page->page['template'] . '/includes/content/'. $page->page['content']);
00162     elseif (parent::TestFile(DIR_WS_INCLUDES.'content/' . $page->page['content'])) $page->page['path_content'] = (DIR_WS_INCLUDES.'content/' . $page->page['content']);
00163     else $page->page['path_content'] = (DIR_WS_INCLUDES.'content/404.php' );
00164 
00165     return($page->page['path_content']);
00166   }

GabaritTemplate::GetSidebar ( bar = 'sidebar'  )  [static, protected]

choose file for include

Parameters:
$bar string bar le nom du fichier a inclure (par defaut sidebar) sans extension

Definition at line 200 of file GabaritTemplate.php.

00200                                                       {
00201     // report des var d'enviroennement
00202     global $page;
00203 
00204     return $page->getPathTemplate().$bar.'.php';
00205   }

GabaritTemplate::GetTypeContent (  )  [static, protected]

determine le type de page (class de page)

Definition at line 108 of file GabaritTemplate.php.

00108                                             {
00109     global $page;
00110 
00111     if(isset(parent::$GlobalCache['gabarit'])){
00112       $page->page['class']=parent::$GlobalCache['class_content'];
00113       return $page->page['type']=parent::$GlobalCache['type_content'];
00114     }
00115     if (isset($_GET['popup'])){
00116       $page->page['type']='popup';
00117     }elseif ($page->page['content']=='index.php' ||$page->page['content']=='home.php'  && (empty($_SERVER['QUERY_STRING']) || (isset($_GET['osCsid']) || isset($_GET['divers']) ) )) {
00118       $page->page['type']='home';
00119     }elseif ($page->page['content']=='index.php' && (!empty($_SERVER['QUERY_STRING']) && isset($_GET['customers_id']) )) {
00120       $page->page['type']='member';
00121       $page->page['class']='single';
00122     }elseif (in_array(substr($page->page['content'],0,7), array('account','address')) || in_array(substr(basename($_SERVER['SCRIPT_NAME']),0,-4), array('account','address')) ) {
00123       $page->page['type']='account';
00124     }elseif (substr($page->page['content'],0,8) =='checkout') {
00125       $page->page['type']='checkout';
00126     }elseif (substr($page->page['content'],0,7) =='product') {
00127       $page->page['type']='product';
00128       $page->page['class']='single';
00129     }elseif (in_array(substr($page->page['content'],0,6) , array('shoppi'))) {
00130       $page->page['type']='cart';
00131     }elseif (substr($page->page['content'],0,9) =='index_cat') {
00132       $page->page['type']='listing_cat';
00133     }elseif (in_array(substr($page->page['content'],0,6) , array('listin','index_','index.'))) {
00134       $page->page['type']='listing';
00135 
00136       if(isset($page->page['var']['manufacturers']))$page->page['class']='manufactuers';
00137       elseif(!empty($page->page['var']['cPath'])) $page->page['class']='categories';
00138       else $page->page['class']='listing';
00139 
00140     }elseif (in_array(substr($page->page['content'],0,7) , array('content')) &&  isset($_GET['content']) ) {
00141       $page->page['type']='content';
00142       $page->page['class']='single';
00143     }else {
00144       $page->page['type']='none';
00145     }
00146 
00147     parent::$GlobalCache['type_content']=$page->page['type'];
00148     parent::$GlobalCache['class_content']=(isset($page->page['class'])? $page->page['class'] :'single' );
00149   }


The documentation for this class was generated from the following file: