开发者

View CSS Layout Query

I have a section of data that loads a main view with a stylesheet etc. What I am trying to do is just load the stylesheet for my respective function 'addSale' - I just want my form style.

My admintemplate is a full document that implements the required php sections. Would my best option be to create three files header navigation and footer? Should I create a separate file for the meta data?

    // Main Page Data 
    $data['sales_pages'] = $this->sales_model->getSalesPages();
    $data['cms_pages'] = $this->navigation_model->getCMSPages();
    $data['title'] = 'Sales';
    $data['content开发者_C百科'] = $this->load->view('admin/sales', $data, TRUE); 
    $this->load->view('admintemplate', $data);
}

function addSale(){
    $data['content'] = $this->load->view('admin/testview',$data);
}


This one: http://ellislab.com/forums/viewthread/194843/ is pretty simple (although it needs a little work to maximize performance).


Of course it depends on each project but I actually usually do 6 view sections: Open, Header, Nav, Body, Footer, Close:

$this->load->view('open', $data);
$this->load->view('header', $data);
$this->load->view('nav', $data);
$this->load->view('body', $data);
$this->load->view('footer', $data);
$this->load->view('close', $data);
  • The open contains meta data, html tag open, javascript includes, and css includes.
  • The header contains the header to my site.
  • The body is obviously the body
  • The footer is the footer
  • The close is any analytics and closing body, head etc.

As separated as possible without becoming convoluted or duplicating code is recommended.

Edit: @Wesley is most right, though, you should use a template library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜