phpeveryday.com

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


CodeIgniter - Form: Putting Text at Header and Footer

Tag: CodeIgniter, framework, MVC   Category: PHP Framework
post: 15 Feb 2008 read: 2,716


CodeIgniter Form Step By Step Tutorial - Part 5: We put menu below header. But we still don't talk about header. Now, we will put some text at header. If you remember, this step is like this post.

Open you controller, "books.php" within CodeIgniter\system\application\controllers. Update like this:


<?
class Books extends Controller{

 	function Books(){
  		parent::Controller();
 	}
	
 	function main(){
  		$this->load->library('MyMenu');
  		$menu = new MyMenu;
  		$data['menu'] 		= $menu->show_menu();
  		$data['webtitle']	= 'Book Collection';
  		$data['websubtitle']= 'We collect 
all title of books on the world';
  		$data['webfooter']	= '© copyright 
by step by step php tutorial';				
		
  		$this->load->view('books_main',$data);
 	}
	
 	function input(){
  		$this->load->library('MyMenu');	
  		$menu = new MyMenu;
  		$data['menu'] = $menu->show_menu();	
  		$data['webtitle']	= 'Book Collection';
  		$data['websubtitle']= 'We collect 
all title of books on the world';
  		$data['webfooter']	= '© copyright 
by step by step php tutorial';
		
  		$this->load->view('books_input',$data);	
 	}
}
?>	

Then update header, "books_header.php" within CodeIgniter\system\application\views.

<h1 id="title">
<?php echo $webtitle; ?>
</h1>
<h2>
<?php echo $websubtitle; ?>
</h2>

Last, update footer, "books_footer.php" within CodeIgniter\system\application\views.

<?php echo $webfooter; ?>

Result like this:

codeigniter layout header footer



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

1 Responses to CodeIgniter - Form: Putting Text at Header and Footer:

It seems that you forgot to put the step-by-step instructions for the footer. But it can also be assumed that you do that for a purpose and that is for the viewers to apply the same thing as in the header.

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


615
posting