HomePHP Adding CSS to Handling Views with CodeIgniter
Adding CSS to Handling Views with CodeIgniter
Welcome to the second installment of a series that shows you how to handle views with CodeIgniter. Made up of seven parts, this series explains different methods that you may use for loading view files within your CI-based web applications, ranging from working with a simple sequential approach, to including views within other views. This part will show you how to improve your web page's appearance with CSS.
If you've had the chance to work with CodeIgniter, then you know that it is a robust framework with many useful features that let PHP programmers build web applications very quickly and with minor efforts. Of course it has the ability to manipulate view files in different ways, which can be quite helpful when creating front-ends for a web application or for a web site.
So, if you’re interested in learning how to load views in all sorts of clever ways with this popular PHP framework, them start reading this series of articles right now!
Returning to the topic of sequential methods, you may recall that in the previous article of this series I demonstrated how to generate independently the header, main area and footer section of a basic web page by loading sequentially three different views. This task was performed by a controller class, which was called “WebPage.”
It's worth mentioning that even though this controller populated the content area of this sample web page with some database records, it didn’t use any model to specifically handle this data. However, don’t worry about this for now, since this topic will be covered in upcoming articles of this series.
Now it’s time to continue exploring the capabilities given by CodeIgniter when it comes to handling views. Since the visual appearance of the web page mentioned above was pretty rudimentary, in this second article I’m going to improve it a bit to make it look more appealing and professional.
So, with the preliminaries out of our way, let’s see how to enhance the look and feel of this example web page. Let’s get started!