1 of 27
1
Tome (Static Pages)
Posted: 19 September 2006 01:12 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Hello,

I developed a simple module today to provide EE with WordPress style static pages.  I found this helpful for creating client sites that needed several pages with only one entry.

Module
The module works by allowing only one entry per category within a certain weblog.  For example, I’ve named a weblog “Pages” and added my site’s footer structure in that weblog’s category group.  So, when publishing a “Static Page” you can choose from “About”, “Privacy”, “FAQ”, “Contact” etc. under categories.  Now, when a user goes through the Pages module to update their “About” page it checks to see if there is already content published within the “About” category in the weblog “Static Pages”.  If there is it will bring up the existing entry, or if not, it will load an empty entry form with “About” category already selected.

I would suggest adding this module as a new tab so that your admin screen reads “Publish | Edit | Pages” for easy navigating.  I’ll usually explain this as “Publish” is for dynamic content such as news articles and blog posts, while “Pages” is for static content such as About.

Extension

BE SURE TO ENABLE THE EXTENSION: It is not enabled at the same time as the module.

Several people have had trouble with the template side of things.  In all of these cases it was due to the extension not being turned on.  Please check that the Pages extension (under Admin » Utilities » Extension Manager) is turned on before asking any template questions it will save you a good deal of time while debugging.

The extension (once enabled) will allow your static pages to use their own custom template, without needing a physical template group.  Under the extension settings you can enable wether these ‘static’ templates should override physical template groups/templates.

Plugins
There are two plugins bundled with this module, the first is the ‘Pages Results’ plugin, to be used on the search results page.. Simply wrap your entire search results within the {exp:pages_results /} tag to fix any links appearing within the search results.  Secondly the ‘Static Page Path’ plugin creates bread crumbs or navigation.  Use it to create bread crumbs as follows:

{exp:static_page_path backspace="3"}<a href="{url_title}" title="{title}">{title}</a> » {/exp:static_page_path}

Or use it to see sub pages of a static page by including the ‘direction’ attribute:

{exp:static_page_path direction="post"}<a href="{url_title}" title="{title}">{title}</a>{/exp:static_page_path}

That will output a nested list, if you would prefer a flat list use the ‘nest="false”’ attribute.  Within a nested list, if you’d like to only show one level include the ‘depth="1”’ attribute, or substitute any number to show x levels below the current static page.  Or if you’d prefer to show all your static pages just pass it a ‘page="0”’ to show all pages.  You can substitute the “0” for any category id, to show all sub-pages below that page.

Let me know if you found this module useful!
Mark.

WARNING (READ: BETA): There are known bugs with this module.  Please download and use it only if you are an experienced EE developer.

File Attachments
mod.pages_360.zip  (File Size: 18KB - Downloads: 746)
 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 20 September 2006 11:59 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  111
Joined  12-29-2004

Mark, I’ve used a similar weblog/category/entry structure for “static” pages that works great structurally except it hasn’t been easy for clients to understand where to find the right entry or having to search through the edit section to get there.

I just tried out your module and I think this is a great way of presenting those entries, especially with a pages tab like you suggest. Great work, and thanks very much for sharing this.

-mike

 Signature 

imagehat studio
the forum user formerly known as lavalamp

Profile
 
 
Posted: 20 September 2006 12:09 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Yup, and the real power is that you can still call the entries with normal EE tags something like {exp:weblog:entries category="about"}{title}{body}{/exp:weblog:entries}

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 13 October 2006 05:34 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

For the benefit of everyone, I’ve created this simple tutorial to get you going if you’re not sure where to start.

Update: To install this module unzip the file and open the language > english folder.  Copy the lang.pages.php into your /system/language/english folder.  Then open the zip’s modules folder and copy the pages directory to your /system/modules folder.

What we’re going to do is assume we’ve been given the task of creating a simple corporate site of about 15 pages.  Most of those pages are fairly static and will only require changing once a year, if that.  Additionally these ‘static’ pages are not recurring.  This means that they only consist of one block of Title, Body, and possibly Footer copy.  First let’s take a look at the site structure:

About Us
-- Contact
-- Directions
-- Staff
---- Bios
---- Extensions
News
Products
Footer
-- Privacy Policy
-- Terms and Conditions

Now, I would set this up in a weblog named “Content Pages” and give it a category tree of the site structure defined above, leaving out News and Products (we’ll come to those later).

Before this module, when my client asked how to update the “Privacy Policy”, I would instruct them to search under the edit tab for content posted to “Content Pages” weblog within the “Privacy Policy” category.  This isn’t too difficult, but it could be better.

This is where the module/extension comes in.  First install it, by moving it into the “modules” folder within your “system” directory.  Install it on the “Modules” tab and the click on it’s name.

When choosing the module for the first time you’ll be presented with a choice of weblogs.  Here you’ll want to choose the “Content Pages” weblog (or whatever weblog is storing your static content).  After saving your selection you’ll see a list of all those categories we set up, perfectly mirroring your site structure.  Clicking “Edit” performs a check.  If there is content posted to the “Content Pages” weblog under the selected category it will automagically jump to that entry.  If not it will open up a new edit page with the proper category already selected.

The News and Products categories should probably be their own weblogs.  This will allow your client to post multiple news items and products, whereas if they were static pages they would only be able to post one entry.

Finally, if you choose to install the extension it will remove the “Content Pages” weblog from the publish menu so your client doesn’t get confused and ask “Why don’t we publish to this one?”

Wait!  You said this was like WordPress.  We’ll it is, except for one minor point.  It doesn’t interact with the templating engine at all.  I’m going to try to work this in for the next release.  Until then you’ll have to create templates for all your static pages and enter entry tags like this {exp:weblog:entries category="Bios"}.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 13 October 2006 05:40 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

One addendum: I find it really useful to add this module as a new tab.  To do so just navigate to the module under the “Modules” tab and then click on it’s name.  This will bring you to the default “Pages” tab.  Now, in the purple title bar click the “New Tab” link on the upper right.  Follow directions and you’re done.  Your tab bar should now read “Publish | Edit | Pages”.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 13 October 2006 07:12 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31281
Joined  05-14-2004

Ah, I had misunderstood how this works - so it still leverages the power of the weblog module, just providing an easier interface? I think I might pop this on my site and give it a shot, then.

Thank you, Mark!

 Signature 
Profile
MSG
 
 
Posted: 13 October 2006 08:21 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Yup.  It’s really cool because it doesn’t add any new functionality to EE, it just alters the way you use EE.  It’s proved immensely helpful on a few of my projects.  Clients can now update pages very easily without having to know the category or entry_id of, for example, the “About Us” page.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 14 October 2006 10:06 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-30-2004

Question—How are you handling a home page as a static page or are you?

Profile
 
 
Posted: 14 October 2006 10:59 PM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Usually I do make the homepage a static page and allow my client access to one content area on the page (just like every other static page).  Then I place content blocks around the page that pull from other weblogs.  So there might be a welcome quote on the page (that’s the static part), then the news stories, or featured callouts are getting pulled from another weblog.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 15 October 2006 12:44 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  01-18-2006

Hi Mark,

Sorry if I’m being daft—I’m new to EE and to your plug-in.

Anyway, I was following your tutorial above, using the same category tree, but I made my first entry in the “Contact” page. Then, I went to make an entry in the “About Us” page, and the content from “Contact” was there instead of the fields being empty. I tried editing content in the “About Us” page and it also changed the content in the “Contact” page. So, my question: Is there a specific order of editing required (parents before children, for example)?

Brilliant plug-in, though. Wish I had found it sooner.

Eric

 Signature 

Eric Barstad
Shadow Box Creative Media Ltd.

EE Pro Network

Profile
 
 
Posted: 15 October 2006 12:46 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

You’ll want to make sure you turn off auto select parent categories under the admin tab

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 15 October 2006 12:52 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  01-18-2006

Sorry, I can’t find that option. :(

Oop, I found it. Thanks!

 Signature 

Eric Barstad
Shadow Box Creative Media Ltd.

EE Pro Network

Profile
 
 
Posted: 15 October 2006 09:35 AM   [ Ignore ]   [ # 12 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-30-2004

In regards to the home page—so you alter the index template to do what you mention?  And then I assume recreate the index page or soemthing like it for those other non static sections?

Profile
 
 
Posted: 15 October 2006 10:23 AM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

ebarstad, you can find it here: CP Home › Admin › Weblog Administration › Global Weblog Preferences › Auto-Assign Category Parents.  You’ll want to turn that off.  If you don’t anything you publish to a child category (like Contact) will also be published to the parent category (About Us).

BPeddle, yes, most of the index pages I do use content from other weblogs.  In the tutorial example above, I might have on my homepage several news entries, and a couple of products, each coming from their respective weblog.  Those would just get pulled in with a normal {exp:weblog:entries /} tag.  The I would also provide a static block containing maybe a quote or a callout, or the client’s elevator pitch.  Something short that won’t change that often.  If that need doesn’t exist on the homepage then I wouldn’t include the homepage in the static pages.

recreate the index page or soemthing like it for those other non static sections

What other non static sections are you talking about?  I’m not entirely sure if I answered your question.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 15 October 2006 10:51 AM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-30-2004

Sorry for so many questions ... I copied the pages directory to the modules folder and when I go tothe modules tab I get an error

Error

Unable to load the following language file:

/lang.pages.php

Im on the latest build of EE

Profile
 
 
Posted: 15 October 2006 10:56 AM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Inside the zip file you can see where everything goes.  There should be two folders, a language fold and a modules folder.  Open the language folder, open the english folder and drag that lang.pages.php file into your /system/language/english folder.  Then open the zip’s modules folder and drag the pages directory to your /system/modules folder.

Hope that helps!
Mark

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 15 October 2006 11:03 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-30-2004

Worked perfect… Thanks, sorry for overlooking that.  Was up until 2:00am getting PHP going on IIS and then getting the ISAPI Rewrite going. 

Can you share the site url where you have all this stuff going on .. would love to see it in action.

Profile
 
 
Posted: 15 October 2006 11:09 AM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-30-2004

I think I got it all going. 

Installed the languages stuff.  Moved the pages folder under modules.  1 think I can’t get working is making the COntent Pages blog not appear in publish.  Am I overlooking something else ...

Profile
 
 
Posted: 15 October 2006 11:19 AM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

It seems I forgot to bundle the extension in the last zip file.  It’s there now if you want to just re-download the zip and drop the extensions>ext.pages.php file in your system>extensions folder.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
   
1 of 27
1
 
‹‹ Solspace Tag Cloud      Files Module ››
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 10:33 AM
Total Registered Members: 61061 Total Logged-in Users: 34
Total Topics: 73880 Total Anonymous Users: 16
Total Replies: 398518 Total Guests: 456
Total Posts: 472398    
Members ( View Memberlist )
Newest Members:  Dale-M Moeen uddinbnolenstanjadebieSan2kakifemreSchottec2kmeenazterjin