Welcome Guest, Not a member yet? Register   Sign In
Modulated Templated CMS system
#14

[eluser]Avatar[/eluser]
environ.php continued:
Code:
function _template_asset_dirs($loc='file')
    {
        if($loc=='db')
        {
            $assets=$this->ci->template_model->get_asset_dirs_by_id($this->template_id);
            foreach($assets->result() as $asset=>$a)
            {
                $this->data['template_images_dir']=$this->template_dir.$a->images_dir;
                $this->data['template_swf_dir']=$this->template_dir.$a->swf_dir;
                $this->data['template_pdf_dir']=$this->template_dir.$a->pdf_dir;
            }        
        }
        else
        {
            $this->data['template_images_dir']=$this->template_dir.$this->data['template_images_dir'][0];
            $this->data['template_swf_dir']=$this->template_dir.$this->data['template_swf_dir'][0];
            $this->data['template_pdf_dir']=$this->template_dir.$this->data['template_pdf_dir'][0];            
        }

    }
    //type can be either css or js and loc can be db or file
    function _template_theme($type='css',$loc='file')
    {
        $func='link'.strtoupper($type);
        if($loc=='db')
        {            
            $vart='theme_'.$type;
            $varg='get_'.$vart;
            $$vart=$this->ci->template_model->$varg($this->template_id);
            foreach($$vart->result() as $$type=>$c)
            {
                $this->data['theme_'.$type]=$this->$func($this->template_dir.$c->url,'theme_'.$type,true);
            }
        }
        else
        {
            foreach($this->data['theme_'.$type] as $$type=>$c)
            {    
                $this->data['theme_'.$type]=$this->$func($this->template_dir.$c,'theme_'.$type,true);
            }    
        }
    }
    function _template($loc='file',$string='layout',$type='id')
    {
        if($loc=='db')
        {
            $func='get_'.$string.'_by_'.$type;
            $vart='template_'.$type;
            $$string=$this->ci->template_model->$func($this->$vart);
            print_r($$string->result());    
            foreach($$string->result() as $k=>$v)
            {
                if($string=='pages')
                if($v->status=='front_page')
                {
//                    if(file_exists($this->template_root.$string.'/tpl_'.$p->url.EXT))
//                    if($this->ci->smarty_parser->template_exists('ci:'.$this->template.$string.'/tpl_'.$p->url.EXT))
//                    {
                        $this->data['template_'.$string]['index_tpl']=$v->text;//'ci:'.$this->template.$string.'/tpl_'.$p->url.EXT;
//                    }
                }
                $this->data['template_'.$string][$v->url.'_tpl']=$v->text;
            }
        }
        else
        {
            foreach($this->data['template_'.$string] as $k=>$v)
            {
                if(file_exists($this->template_root.$string.'/tpl_'.$v.EXT))
                if($this->ci->smarty_parser->template_exists('ci:'.$this->template.$string.'/tpl_'.$v.EXT))
                {
                    $this->data['template_'.$string][$this->data['template_'.$string][$k].'_tpl']='ci:'.$this->template.$string.'/tpl_'.$v.EXT;
                }    
            }

        }

    }



    //this function sets the template directory variable variants
    function _set_template()
    {
        if($this->template_name=='')
        {
            $this->template_name='default_template';
            $this->template='smarty/'.$this->template_name.'/';
            $this->template_root=$this->document_path.'smarty/'.$this->templates_folder.$this->template_name.'/';
            $this->template_dir=$this->template.'/';
        }
        else
        {
            $this->template='smarty/'.$this->templates_folder.$this->template_name.'/';
            $this->template_root=$this->document_path.'smarty/'.$this->templates_folder.$this->template_name.'/';
            $this->template_dir=site_url().$this->templates_folder.$this->template_name.'/';
        }
    }
    //when configuration is from flat file this function sets the template variables into data
    function _theme_config($theme_config='')
    {
        if(is_array($theme_config))
        {
            foreach($theme_config as $the =>$theme)
            {
                if(is_array($theme))
                {
                    foreach($theme as $var =>$val)
                    {
                        $this->data[$val]=$the;
                    }
                }
                else
                {
                    $this->data[$theme]=$the;
                }
            }
        }
        
        $this->data=$this->_array_invert($this->data);
    }
    //when config is from flat file this function inverts the data array
    function _array_invert($arr)
    {
        $res = Array();
        foreach(array_keys($arr) as $key)
      {
          if (!array_key_exists($arr[$key], $res)) $res[$arr[$key]] = Array();
        array_push($res[$arr[$key]], $key);
      }
      return $res;
    }


Messages In This Thread
Modulated Templated CMS system - by El Forum - 03-05-2008, 12:02 PM
Modulated Templated CMS system - by El Forum - 03-05-2008, 12:08 PM
Modulated Templated CMS system - by El Forum - 03-05-2008, 12:15 PM
Modulated Templated CMS system - by El Forum - 03-05-2008, 12:18 PM
Modulated Templated CMS system - by El Forum - 03-05-2008, 01:03 PM
Modulated Templated CMS system - by El Forum - 03-06-2008, 11:46 PM
Modulated Templated CMS system - by El Forum - 03-07-2008, 01:41 AM
Modulated Templated CMS system - by El Forum - 03-07-2008, 03:59 AM
Modulated Templated CMS system - by El Forum - 03-16-2008, 10:07 AM
Modulated Templated CMS system - by El Forum - 03-16-2008, 05:51 PM
Modulated Templated CMS system - by El Forum - 03-16-2008, 07:05 PM
Modulated Templated CMS system - by El Forum - 03-16-2008, 08:02 PM
Modulated Templated CMS system - by El Forum - 03-17-2008, 03:36 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 03:38 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 03:39 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 03:52 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:26 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:29 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:35 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:41 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:46 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 04:53 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 10:38 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 10:45 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 10:52 AM
Modulated Templated CMS system - by El Forum - 03-17-2008, 07:01 PM
Modulated Templated CMS system - by El Forum - 05-11-2008, 12:06 PM
Modulated Templated CMS system - by El Forum - 06-12-2008, 08:41 PM
Modulated Templated CMS system - by El Forum - 07-24-2009, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB