O'Reilly logo

CodeIgniter 1.7 by David Upton, Jose Argudo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Nesting views

So far, irrespective of whether we use long or short PHP formats, this is pretty crude HTML. It would be nice, for instance, to put more information in the <head> section of the page. Better still, if this could be a standard chunk of each page. Once again, something we have to write (or alter) only once, and can reuse it, by nesting this view inside other views whenever we need the boring HTML header stuff.

Let's create a page header "view" for our site, which displays a standard page header, as well as HTML declarations and meta-information.

First, we type the code for our "nested" header view:

<!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'> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required