phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


CodeIgniter - Form: Creating Layout Code

Tag: CodeIgniter, framework, MVC, layout   Category: PHP Framework
post: 14 Feb 2008 read: 3,669


CodeIgniter Form Step By Step Tutorial - Part 3: At this post, we will write simple code for showing our layout. Follow this step:

  1. Open books.php within CodeIgniter\system\application\controllers. Enter following code:
    <?
    class Books extends Controller{
    
     	function Books(){
      		parent::Controller();
     	}
    	
     	function main(){
      		$this->load->view('books_main');
     	}
    	
     	function input(){
      		$this->load->view('books_input');	
     	}
    }
    ?>
  2. Open books_main.php within CodeIgniter\system\application\views.
    <html>
    <head></head>
    <body>
    <div id="header">
    <? $this->load->view('books_header'); ?>
    </div>
    <div id="menu">
    <? $this->load->view('books_menu'); ?>
    </div>
    
    test list
    
    <div id="footer">
    <? $this->load->view('books_footer'); ?>
    </div>
    
    </body>
    </html>

    I think, it is simple to understand for you. Right?

  3. Open books_input.php within CodeIgniter\system\application\views.
    <html>
    <head></head>
    <body>
    <div id="header">
    <? $this->load->view('books_header'); ?>
    </div>
    <div id="menu">
    <? $this->load->view('books_menu'); ?>
    </div>
    
    test input
    
    <div id="footer">
    <? $this->load->view('books_footer'); ?>
    </div>
    
    </body>
    </html>
  4. Open books_menu.php within CodeIgniter\system\application\views.
    menu: 
    <a href="main">List</a> |  <a href="input">Input</a>
  5. Open books_header.php within CodeIgniter\system\application\views.
    
    test header
    
  6. Open books_footer.php within CodeIgniter\system\application\views.
    
    test footer
    

Now, point your browser to http://localhost/CodeIgniter/index.php/books/main

codeigniter simple layout application



Series this article:
CodeIgniter - Form: Creating Skeleton
CodeIgniter - Form: File Structure
CodeIgniter - Form: Creating Layout Code
CodeIgniter - Form: Creating Menu Library
CodeIgniter - Form: Putting Text at Header and Footer
CodeIgniter - Form: Centralizing $data
CodeIgniter - Form: Adding CSS
CodeIgniter - Form: Creating Form HTML
CodeIgniter - Form: Creating Beautiful Form Code
CodeIgniter - Form: CodeIgniter HTML Style
CodeIgniter - Form: Preparing Table at Database
CodeIgniter - Form: Creating Insert Data
CodeIgniter - Form: Creating List Data Use Table Library
CodeIgniter - Form: Creating Table List Without Table Library
CodeIgniter - Form: Using URL Helper
CodeIgniter - Form: Showing Single Data for Form Edit
CodeIgniter - Form: Something Happen With Form Parameters
CodeIgniter - Form: Updating Data
CodeIgniter - Form: Deleting Data

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting