A simple CSS file, it ’ s time to create a generic Template view that
you can reuse throughout your application. In this master template, which
you can name template.php, are a series of embedded PHP calls that load
certain subviews, such as header, navigation, and footer.
These subviews contain the HTML and PHP that you will create in the
next few sections. Notice in the following code that you ’ re also trying
to load a subview with $main. This variable will contain the name of a
subview that is dynamically set within the controller and allows you a
great deal of flexibility as you code your application.
< !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd” >
< html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en” >
< head >
< meta http-equiv=”content-type” content=”text/html; charset=utf-8” / >
< title > < ?php echo $title; ? > < /title >
< link href=” < ?= base_url();? > css/default.css” rel=”stylesheet” type=”text/css” / >
< script type=”text/javascript” >
// < ![CDATA[
base_url = ‘ < ?= base_url();? > ’;
//]] >
< /script >
< /head >
< body >
< div id=”wrapper” >
< div id=”header” >
< ?php $this- > load- > view(‘header’);? >
< /div >
< div id=”nav” >
< ?php $this- > load- > view(‘navigation’);? >
< /div >
< div id=”main” >
< ?php $this- > load- > view($main);? >
< /div >
< div id=”footer” >
< ?php $this- > load- > view(‘footer’);? >
< /div >
< /div >
< /body >
< /html >
you can reuse throughout your application. In this master template, which
you can name template.php, are a series of embedded PHP calls that load
certain subviews, such as header, navigation, and footer.
These subviews contain the HTML and PHP that you will create in the
next few sections. Notice in the following code that you ’ re also trying
to load a subview with $main. This variable will contain the name of a
subview that is dynamically set within the controller and allows you a
great deal of flexibility as you code your application.
< !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd” >
< html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en” >
< head >
< meta http-equiv=”content-type” content=”text/html; charset=utf-8” / >
< title > < ?php echo $title; ? > < /title >
< link href=” < ?= base_url();? > css/default.css” rel=”stylesheet” type=”text/css” / >
< script type=”text/javascript” >
// < ![CDATA[
base_url = ‘ < ?= base_url();? > ’;
//]] >
< /script >
< /head >
< body >
< div id=”wrapper” >
< div id=”header” >
< ?php $this- > load- > view(‘header’);? >
< /div >
< div id=”nav” >
< ?php $this- > load- > view(‘navigation’);? >
< /div >
< div id=”main” >
< ?php $this- > load- > view($main);? >
< /div >
< div id=”footer” >
< ?php $this- > load- > view(‘footer’);? >
< /div >
< /div >
< /body >
< /html >