Confused on basic EE template structure
Posted: 06 September 2008 01:09 PM   [ Ignore ]  
Summer Student
Total Posts:  6
Joined  09-03-2008

I recently made the decision to move from EE from Wordpress.

Here is an image of the website: my web design

I am confused on how EE handles templates. In my website I have 2 repeating “templates” that are included on the page no matter what and they are the header and footer. Basially I want to know the best way to do this.

Here is how I am doing it currently (Lets take the “About page” for example):
I have made a new template group for the “About page” and called it “about”
In that template group I have the index.php which includes the following:

{embed="epv3/header"}

{exp
:weblog:entries weblog="about"}
<h3>{title}</h3>
{body}
<div class="date">Posted on {entry_date format="%M %d, %Y - %h:%i %A"}</div>
{/exp:weblog:entries}

{embed
="epv3/sidebar}
{embed="
epv3/footer"}

If I continue doing it this way I have to manually embed the header and footer in every template. I am sure this must be an easier way to do this - maybe like some sort of parent template?

Any ideas?

Profile
 
 
Posted: 06 September 2008 01:48 PM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1470
Joined  08-28-2003

This will depend on how you structure the site and how many actual “pages” you have. For example, the home page (Index) is a page which consists of a template, probably with other templates embedded into it (header, footer, body, right column, etc.). That’s rather standard.

You also need a page/template for Entries, maybe one for Archives, another for Categories, and so on. Each is a similar page in that the Header, Footer and other elements may be the same, probably even in the same location on the page. For each of those Page templates you’ll need to embed {embed=“template_group/template_name”} the appropriate template.

While that may sound like a lot of effort it’s really nothing more than copy and paste for each of those site pages, not for each page where there’s an entry. Most EE sites I manage have only five or six “pages” each of which has embeds to hold various page elements.

 Signature 

RonnieMc

Honolulu, HI USA

HomeMac360

Profile
 
 
Posted: 06 September 2008 02:06 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  205
Joined  05-05-2008

everpixel,
One of the first problems i see is that one of your embeds is not closed properly.

{embed="epv3/sidebar}

Second each template group is a “directory”. For example you design your about page the way its supposed to look. Inside of the index template inside of the about template group could look like this:

So if you wanted the site to look like site.com/about you would add a new template group called about. When you are creating a template group you can copy another template group to save yourself some time. It might be the easier for you to create a “template” template group so you can choose this to copy from when creating a new group.

 Signature 

Invoked Projects


Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 06 September 2008 02:44 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  436
Joined  02-02-2006

everpixel, if some of those embedded templates will always appear together, you can combine them into one template and embed it. But, otherwise, you’re going about this the right way, as far as I can tell.

 Signature 

Learn EE step-by-step with the ExpressionEngine Screencasts

Ryan Irelan

Profile
 
 
Posted: 06 September 2008 02:49 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  6
Joined  09-03-2008

Thanks for the prompt help guys, I appreciated it.

You all solved my issue.

Profile
 
 
Posted: 07 September 2008 12:34 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  438
Joined  02-09-2004

On thing I like to do with headers, footers, etc. is make them “invisible” templates.

I make a template group called “embeds” and anything I put it this group I state with a dot. “.sidebar, .footer, .etc.”). This prevents people from navigating directly to that template.

Not that it would matter a whole lot in most cases, but you can get weirdness if someone brought up just your sidebar or whatever. It’s just prettier.

The bestest thing about using embeds is that they are so easy to change. Add one thing in on your .header file, and it’s instantly updated sitewide.

I went a bit embed crazy on my first site once I figure out how to do this. I then figured out a lot of the things I made as embeds could be their own weblog. For example, I have a “Currently Reading” element on one of my sidebars. This is an embed that I manually update, but in retrospect it would have been better off being a weblog (restricted to current entry). This way I could maintain a history of the books I’ve read, and update from within the CP rather than the flat file. Oh well, live and learn.

 Signature 

http://www.jackassletters.com
http://christopher.jorgensen.name

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64912 Total Logged-in Users: 31
Total Topics: 81863 Total Anonymous Users: 14
Total Replies: 440098 Total Guests: 195
Total Posts: 521961    
Members ( View Memberlist )
Newest Members:  bjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkeybenekwhobutsb