Moving into the index template and designing a data structure.
This is Chapter 3 in a series on building a complete small-business website on ExpressionEngine.
In Chapter 1 we found a free HTML/CSS template to use as a basis for the site, downloaded it, tweaked image paths and CSS links, and loaded it into EE. In Chapter 2, we took the main template and “chunked it up” by pulling out HTML elements that would repeat throughout the site, saved them into discreet templates, and embedded them back into the main page template.
In this chapter we’ll start “moving into” the template by tweaking the navigation structure, getting our site name in the masthead and browser title bar, and deciding what our data structure will be.
Just as an aside—I’ve created a specific category for this series with it’s own RSS feed for those who want to subscribe to it specifically. I’ll continue to place these articles in the main EE category as well.
OK - let’s work from the top down on making our changes to the template.
Browser Title Bar
For now, we’ll edit this to just show a “root” title—in a future chapter I’ll cover how to append a dynamic element onto the end of it for sections deeper into the site. You’ll want to edit the “html” template created in Chapter 2. Currently it just has “Template1” in the title tags - I’m going to use an EE Standard Global Variable called { site_name } (remove the spaces). The contents of this variable are initially specified during EE installation, but are also set in your EE Control Panel under Admin > System Preferences > General Configuration > Name of your site. In my case this will render as “Boyink Interactive”. I’ll also append the “Building an ExpressionEngine Site” positioning text.
Make your changes, click “Update and Finished” and refresh the template in your browser to see changes.
Editing the Masthead
Pretty simple here - in the “logo_title” embedded template I’m going to again use the Global Variable { site_name } (remove the spaces) in the h1 tags, and hardcode a slogan into the spanned text. Make your changes, click “Update and Finished”, and refresh the parent template in your browser to see the changes.
On second thought - as we round out this site we’ll want the h1 text to link back to the index page, so I added a link directly to this Building Series index template. In your case, if this is a true site-wide home page link you can use another EE Standard Global Variable called { homepage } (remove the spaces) for the link target URL. This way both the link target and link text of your homepage link are set by variables that are easily changed. This is nice for when you are building a new site at a temporary URL. As part of your “go-live” process you can update the homepage URL in the Control Panel and this link will reflect the change.
After making the main site title a link, I can see that now is one of those times when the template will need it’s CSS tweaked as evidently the creator didn’t think we’d want the main name linked anywhere. Again I’m going to assume you’re comfortable tweaking CSS and just try to stick to the specifics of EE implementation here - you just need an entry in the CSS template that covers a #title .green a element. I just copied the color values from the #title .green declaration.
OK - with the site masthead edited to include our site name and a home page link, let’s move down the page to the main navigation.
Tweaking Navigation
For my site I want main navigation of
So I need to edit the “main_” embedded template. The template is a simple unordered list—which I’m going to assume you are capable of editing to suit as well as I am. Since we’re building the home page first I’m also going to move the active class indicator from “about” to “home. Also note that you can again use the EE Global Variable { homepage } (remove the spaces) as the href value in the home page link.
Make your changes to the main navigation, and click “Update and Finished”. Here are the results of my work - the template now showing an updated browser title, mast head, and main navigation.
Developing a Data Structure
One natural next step right at this place would be to start implementing weblogs, fields, and category groups to hold our content. That was my original intent, in fact, for this chapter.
However - before making that move let’s step back and think about the overall site data structure. This is a point of confusion for many newcomers to ExpressionEngine - due at least in part to how flexible EE is. This is a good time to read the Category or Weblog entry in the EE Wiki if you haven’t already.
In addition to the issues covered in that wiki post, another important one for me - since I’m usually building EE-based sites for clients - is what structure is going to be most understandable for them. Let’s work backwards through our main nav and see what the requirements of each section will be. The potential spot for client confusion will come up as we get back to the Home and About sections:
So there’s our data structure requirements—5 weblogs, two category groups, and 3 custom field groups. I always end up adding one weblog to that structure for miscellaneous content—like site footers, messages returned after searches with no results, and in this case specifically I’ll use this weblog to hold the paragraph to the left of the search field. I think these would work well as section overviews or customer testimonials and would rather they be editable in weblog posts rather than hardcoded into templates.
Changing the Plan
In Chapter 2 I said that this in this chapter we’d actually implement at weblog and move our index template content into it, then add the EE tags on the template to pull that content back out of the EE database.
Well, I lied…
After reading through what I already have in this chapter and how long it is already I think this is a good place to break. I’d forgotten how important and potentially confusing the data structure issue can be for people new to EE. The number of items in the data structure is a key variable for me in estimating the scope and related costs for developing EE-based sites for clients as it directly determines the amount of time setting up and configuring the backend of EE for a given site.
In Chapter 4 we’ll start implementing the data structure and replacing static content on our template with EE tags to pull content from the database.
Visit Train-ee.com for the latest in ExpressionEngine training designed with one goal in mind - to get you up to speed on ExpressionEngine® as quickly as possible.
The latest Train-ee Products:
The latest from the Train-ee blog:
August 17, 2007
OK, so its always a good idea to map out the structure of your site so that you can understand where the weblogs are needed and where the categories are needed - a classic annotated pen and pencil site map. That was, I suppose, so we can see where to tie categories together between sections/weblogs. Good stuff!
September 12, 2007
I am building my first site using a CMS. I usually build large sites with Dreamweaver and using PHP includes & templates. I am a little confused on using Weblogs, templates & categories in EE. I am not use to having restrictions on file names/locations.
If I plan on having multiple sections (About, Services, Product, ect) and within each of those sections and I plan on having more sections (flash, seo, ect) and within those sections I have even more links/pages (banners, games, ect).... What is your recommendation on how to set up the back end structure? Should I be using multiple templates? Should I use categories?
I would like my URLs to be something like:
mysite.com/about/
mysite.com/services/
mysite.com/services/flash/
mysite.com/services/flash/banners
Thanks! The information on your “Building an ExpressionEngine Site” is a great help!
September 13, 2007
Hi Brian -
EE is a bit of a paradigm shift from traditional web development, in that you spend far less time dealing with files and folders on the server.
But - it’s just different, and not as restrictive as you might think. Instead of folders on the server, think of template groups within EE. Rather than files on the server, think templates.
For your examples, I’d create an “about” template group (and it would probably only have an index template in it, which would come up by default at that url), and a “Services” template group with an index template, and a “flash” template. “Banners” would be an entry in a weblog, so your services/flash/banners structure could be template group/template/url_title.
If the urls are highly important you can also look at using the Pages module be set them more specifically. I don’t typically design from the URL out, as I don’t believe end users care so much about url structure as they do page structure and navigation design (I know, big can of worms there...
)
So overall - I’d recommend one weblog per section, yes to multiple templates, not sure on categories, and possibly the Pages module.
October 22, 2007
I know you’ve probably heard this a thousand times now, but thank you, thank you, thank you for these tutorials. They are infinitely helpful in aligning my xhtml/css brian to EE.
October 22, 2007
oops! my “brain” not my “brian!!
Vanessa
January 15, 2008
FYI: The Building an ExpressionEngine Site series is now available for purchase as an eBook on the newly-launched Train-ee.com.
January 30, 2008
Just adding my thanks for this extremely helpful and well-written set of tutorials.
You have a real talent for breaking down information into digestible steps-- an underrated skill, in my experience.
I’m curious to see what other types of tutorials you may have written (or plan to write)…
January 30, 2008
Thanks Juim -
I have a number of ideas..now it’s just finding the time..
April 01, 2008
I\’ve got a q: in WP if I have both tag \’word\’ and category \’Word\’, so in category the first char is UC, therefore tag is UC too… is there such a mistake in EE?