• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
class Page and Db

#1
[eluser]cPage[/eluser]
They told me to keep it simple.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Yaml extends CI_Controller
{
public function __construct()
{
  parent::__construct();
  $this->load->library('Page',array('title'=>'Yaml'));
  $this->load->library('Db');
  $this->page->set_lang('en');
  $this->page->add_meta(array('name'=>'viewport','content'=>'width=device-width,initial-scale=1.0'));
  $this->page->add_meta(array('name'=>'description','content'=>'Yaml CSS framework'));
  $this->page->add_css('base','assets/css/yaml/core');
  $this->page->add_css('iehacks','assets/css/yaml/core');
  $this->page->add_css('hlist','assets/css/yaml/navigation');
  $this->page->add_css('central','assets/css/yaml');
  $this->page->add_css('gray-theme','assets/css/yaml/forms');
  $this->page->add_css('screen','assets/css/yaml/screen');
  $this->page->add_css('typography','assets/css/yaml/screen');
  $this->page->add_css('print','assets/css/yaml/print');
  $this->page->add_css('screen-FULLPAGE-layout','assets/yaml/screen');
}

public function index()
{
  //-- HEADER
  $this->page->set_html('h1','htitle','YAML : css framework');
  $this->page->set_view('header',$this->page->get_html());
  //-- 3 COLUMNS (Default)
  $this->page->set_html('p','just-an-id',$this->db->data['texts'][11]['text']);
  $this->page->set_html('div',NULL,$this->page->get_html(),'ym-cbox');
  $this->page->set_html('div','dcol1',$this->page->get_html(),'ym-col1');
  $this->page->set_child();
  
  $this->page->set_html('p',NULL,$this->db->data['texts'][11]['text']);
  $this->page->set_html('div',NULL,$this->page->get_html(),'ym-cbox');
  $this->page->set_html('div','dcol2',$this->page->get_html(),'ym-col2');
  $this->page->set_child();
  
  $this->page->set_html('h4',NULL,'Column 3 : screen-FULLPAGE-layout');
  $this->page->set_html('p',NULL,$this->db->data['texts'][11]['text']);
  $this->page->set_html('div',NULL,$this->page->create_html(NULL,CONCAT),'ym-cbox');
  $this->page->set_html('div','dcol3',$this->page->get_html(),'ym-col3');
  $this->page->set_child();  
  
  $this->page->set_parent();
  // -- CONTENT
  $this->page->set_html('div','main',$this->page->create_html(),'ym-column');
  $this->page->set_view('content',$this->page->get_html());
  
  // -- FOOTER
  $this->page->set_html('h4',NULL,'screen-FULLPAGE-layout');
  $this->page->set_view('footer',$this->page->get_html());
  $this->compile();
}
  
public function compile()
{
  $fname = $this->page->to_ascii($this->page->title);
  if( file_exists('./html/'.$fname.'.html'))
  {
   $t['all'] = file_get_contents('./html/'.$fname.'.html');
  }
  else
  {
   $t['all'] = $this->page->create_page('yaml/layout',SAVE);
  }
  $this->load->view('all',$t);
}
}


Messages In This Thread
class Page and Db - by El Forum - 04-16-2012, 09:23 AM
class Page and Db - by El Forum - 05-06-2012, 10:09 PM
class Page and Db - by El Forum - 05-06-2012, 10:35 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.