Professional CodeIgniter

(singke) #1

Chapter 3: A 10,000 - Foot View of CodeIgniter


70


Right before the Template view is loaded, there ’ s a call to $this - > load - > vars() , which makes
the $data array available to not only the final view, but all the subviews as well. Running this
command precludes the need to pass $data in as a second argument to
$this - > load - > view().

Since this is extremely basic, before you progress, it ’ s time to create the views needed.

Views


At this point, you ’ re only ready to start tackling views in a very limited way — specifically, creating
reusable components for the project. Have a quick look at your mockup of the home page to plan out
which components you ’ ll need for the project (see Figure 3 - 4 ). As you work, you ’ ll place these
components into the /system/application/views/ folder.


Figure 3-4

Any experienced web developer will tell you that a template of this nature has at least three reusable
components:

A wide horizontal header bar, containing the logo, global navigation, and search widget

A wide horizontal footer bar, containing the copyright notice and a link to the privacy statement

A narrow vertical navigation component that provides links to categories

The rest of the page real estate consists of content that changes from page to page. The home page may
use this real estate to show a featured item, whereas the search() function might use that same real
estate to display appropriate search results.



Free download pdf