Structure is a new way to build ExpressionEngine sites. It forgoes the current template_group/template setup and creates “static” and “listing” pages that are all editable through a tree sitemap view. Now, traditional page style content and multiple entry pages can live within the same area. Your clients & authors will rejoice.

Download structure-1.2.7.zip v1.2.7 (348k)

By downloading this software you assume all responsibility for its use and absolve nGen Works of any liability and/or responsibility of any kind.

Requirements

  • PHP 5 or greater
  • CP jQuery (included with EE as of version 1.6.5)

Installation

  • Make sure the native EE Pages module is not installed, uninstall if not
  • In each weblog, turn off "Display Pages Submission Fields." Otherwise, it will attempt to post Pages data and cause an error.
  • Enable the extension CP jQuery under Admin » Utilities » Extension Manager
  • Copy extensions/ext.structure_ext.php to /system/extensions/
  • Copy language/english/lang.structure.php & land.structure_ext.php to /system/language/english/
  • Copy themes/structure directory to your current cp theme folder under /themes/cp_themes/your_theme
  • Copy modules/structure to /system/modules/
  • Enable the extension under Admin » Utilities » Extension Manager
  • Go to the Modules tab
  • Click "Install" in the row for "Structure"

Getting Started

  • Setup your weblogs & custom fields
  • Assign which weblogs Structure will use under Structure » Settings
  • Assign default templates for each weblog under Structure » Settings
  • Create your first entries through the Publish tab and add URIs under the Structure tab while editing the entry
  • Further pages can be added by the same method and assigning parents under the Structure tab or through the “add page” link next to each page
  • Structure will automatically generate URIs for you if you leave them blank
  • A full tutorial can be found on Jambor-ee

Configuration

  • Templates can be changed any time per page by editing the “Template” dropdown under the Structure tab when editing an entry
  • Various changes and preferences can be set under Structure » Settings
    • Weblogs: select where Structure can post data to
    • Default templates: select which templates entries should be attached to
    • Administer Structure: users can make changes to Structure settings and have unlimited reordering capability
    • View publish/edit Structure tab: users can view the Structure tab when publishing or editing to update URLs, change templates and manage listings.
    • Access Structure page: users can access the Structure module
    • View add page link: users can use the “add page” functionality
    • Can reorder (limited): users can reorder pages within the same level, except top level pages (this stops them from breaking top level or main navigation)
    • Can delete (limited): users can delete Structure pages (except top level pages), but it does not delete the entry
  • Clicking “add page” next to an existing one creates a child page and utilizes the same weblog as the parent

Displaying Content & Linking to Pages

A regular weblog tag will display content as long as you don’t have dynamic="off" as a parameter in {exp:weblog:entries}. Pages can be linked to within {exp:weblog:entries} with the variables {page_uri} and {page_url}.

Adding Listings

A page with “static content” can also have a listing. This is basically a bridge between the publish and edit tab with Structure for easier access for authors. This places “Add / Edit” links next to the page name. “Add” cues a new entry for the weblog it’s assigned to while “Edit” cues the Edit tab and sorts entries for only that weblog. This can only be done if you have a weblog not being used for your “static” pages and can NOT be shared with another listing. By assigning the default template under Structure » Settings you decide which template those single entries use.

  • When editing an entry use the Structure tab to mark the checkbox for “Listing”
  • Select which weblog you want the listing entries to post to (this is NOT the weblog the “page” content will post to, but what the “Add / Edit” links use)
  • The template your main listing page uses will need a {exp:weblog:entries dynamic=”off” weblog=”YOUR_LISTING_WEBLOG”} to display the entry listing
  • Once on the single entry/detail page any {exp:weblog:entries} tag will display content as other normal Structure pages.

Asset Weblogs

Assets give you an easy way to manage non-structural weblogs from the same control panel page as your sitemap view. You assign a weblog as an asset under the settings menu. This extra panel appears below your pages and has an "Add / Edit" set of links, just like listings. No Structure data is added to these entries. These extra areas are good for elements and data that authors/clients need access to edit, but are not specific to a certain page.

Main Navigation

{exp:structure:nav_main}

The nav_main tag outputs all of your top level pages into an <ul>. The tag will automatically add class="here" to the current page’s <li> and class="last" to the last <li>. It will also automatically add id="nav" to each list item. Automatically excludes entries marked with the "closed" status.

Exclude Status

{exp:structure:nav_main exclude_status="hidden|no_main_nav"}

The parameter "exclude_status=" can be used to hide any single or multiple user defined statuses using the pipe character.

Sub-Navigation

{exp:structure:nav_sub}

The nav_sub tag is intended for sub-navigation and will show up to two levels of <ul>s at a time. It dynamically shows pages at the same level and jumps to a child’s level if it has children itself. The logic is for a very specific use and at this time does not include attributes to control it’s output. The tag will automatically add class="here" to the current page’s <li> and class="last" to the last <li>. Automatically excludes entries marked with the "closed" status.

Exclude Status

{exp:structure:nav_sub exclude_status="status1|status2"}

The parameter "exclude_status=" can be used to hide any single or multiple user defined statuses using the pipe character. This is useful for form confirmation or non-structural pages you don't want to appear in the sub-navigation. If a page is excluded all of it's children will be removed from being displayed as well.

Start From

{exp:structure:nav_sub start_from="/about"}

The parameter "start_from=" can be used to display a different page's children. Defaults to the current page's children and the logic above if not set. This is useful for pages outside of Structure to mimic the same hierarchy. This mode switches the tag to "fixed" mode, where it will show ALL levels of children as you drill down instead of just children pages. The "start_from" parameter MUST BE FULL URI! Example: start_from="/about/company" or start_from="/{segment_1}/{segment_2}". This parameter can be used to switch certain pages back to the alternate mode if required.

Show Level Classes

{exp:structure:nav_sub show_level_classes="yes|no"}, "yes" by default

Displays class="sub_level_0", class="sub_level_1", etc on <li>s

Show Overview Link

{exp:structure:nav_sub show_overview_link="yes|no"}, "no" by default

Displays a link for "Overview" as the first subnav point in a section's landing page to designate where you are in the subnav hierarchy right away.

Limit Depth

{exp:structure:nav_sub limit_depth="2"}, no limit by default

Limits how deep children pages are shown with the start_from parameter.

Show Depth

{exp:structure:nav_sub show_depth="2"}, no limit by default

Always show children pages up to a specified depth. Designed to work with the start_from parameter.

CSS ID

{exp:structure:nav_sub css_id="foo"}, "nav(current EE separator)sub" by default

Assigns an ID to the <ul>. You can add "none" to optionally display no ID.

CSS Class

{exp:structure:nav_sub css_class="foo"}, none by default

Assigns a class to the <ul>.

Breadcrumbs

{exp:structure:breadcrumb}

The breadcrumb tag displays in a standardized format and has a few parameters to control its output.

Format

Path » To » This » Page » Here

Home Link

{exp:structure:breadcrumb inc_home="no"}, "yes" by default

Include "Here" (current page)

{exp:structure:breadcrumb inc_here="no"}, "yes" by default

Page Title Instead of "Here"

{exp:structure:breadcrumb here_as_title="yes"}, "no" by default

Wrap Each

<ul>{exp:structure:breadcrumb wrap_each="li"}</ul>, empty by default (do not include < or > around tag)

Wrap Here

{exp:structure:breadcrumb wrap_here="em"}, empty by default (do not include < or > around tag)

Separator

{exp:structure:breadcrumb separator=":"} (spaces are automatically added around the element), "»" by default

Include Separator

{exp:structure:breadcrumb inc_separator="no"}, "yes" by default

Wrap Separator

{exp:structure:breadcrumb wrap_separator="span"}, empty by default (do not include < or > around tag)

Showing a Specific Breadcrumb

{exp:structure:breadcrumb uri="{page_uri}"}, useful for search results pages to show where item was found (Example: "Found in About » News")

Several parameters have been contributed by Aaron Gustafson @ easy-designs.net - thanks, Aaron!

Title Trail

{exp:structure:titletrail}

The titletrail tag displays in a standardized format and has a few parameters to control its output.

Format

Page You're On » Parent Page » Top Level Nav » Site Name

Seperator

{exp:structure:titletrail separator=":"} (spaces are automatically added around the element), "|" by default

Reverse

{exp:structure:titletrail reverse="yes"} Outputs "Site Name » Parent Page » Page You're On"

Parent Title

{exp:structure:parent_title}

Returns the current page's parent title

Sitemap

{exp:structure:sitemap}

Returns a full tree of all Structure pages with nested <ul>s. Automatically excludes entries marked with the "closed" status.

Exclude Status

{exp:structure:sitemap exclude_status="status1|status2"}

The parameter "exclude_status=" can be used to hide any single or multiple user defined statuses using the pipe character. If a page is excluded all of it's children will be removed from being displayed as well.

Page Slug

{exp:structure:page_slug}

Returns the current page's URI slug (last segment)

Specific Entry Slugs

{exp:structure:page_slug entry_id="3"} OR {exp:structure:page_slug entry_id="{entry_id}"}, current page by default

Pagination

{exp:structure:paginate parse="inward"}{exp:weblog:entries weblog="your-weblog" dynamic="off" limit="10"}{/exp:weblog:entries}{/exp:structure:paginate}

Requires parse="inward" and retrieves all needed data/params from {exp:weblog:entries} tag it surrounds. The offset parameter is NOT required in contained weblog tag

Location

{exp:structure:paginate location="both"} where to show the pagination, "bottom" by default

First & Last Links

{exp:structure:paginate show_first_last="no"}, "yes" by default

Next & Previous Links

{exp:structure:paginate show_next_previous="no"}, "yes" by default

Show Page & Total

{exp:structure:paginate show_page_total="yes"} displays "Page 1 of 42", "no" by default

Type of Pagination

{exp:structure:paginate mode="jumping OR sliding"} "jumping" shows a set of XX amount of links while "sliding" always show XX amount before and after the current page, "sliding" by default

Number of Pages to Show

{exp:structure:paginate show_num_pages=""} if mode = jumping it will show that amount of links at a time, if mode = sliding it will show that amount before and after current page

Text: First Link

{exp:structure:paginate first="« First"} changes the link text, "First" by default

Text: Last Link

{exp:structure:paginate last="Last »"} changes the link text, "Last" by default

Text: Previous Link

{exp:structure:paginate previous="« Previous"} changes the link text, "Previous" by default

Text: Next Link

{exp:structure:paginate next="Next »"} changes the link text, "Next" by default

Screenshots

Screen: main Structure tab Screen: Structure settings Screen: publish/edit tab

Updates

Structure can call home and check for recent updates, then display a notice on your CP homepage. For this to work, you need to install the LG Addon Updater Extension. You can turn this setting on under Admin » Utilities » Extension Settings » Structure » Settings.

Change Log

  • 1.2.7 5/26/2009
    • {exp:structure:nav_sub} new parameter "limit_depth"
    • {exp:structure:nav_sub} new parameter "show_depth"
    • {exp:structure:nav_sub} new parameter "css_id"
    • {exp:structure:nav_sub} new parameter "css_class"
    • Code refactoring
  • 1.2.6 5/14/2009 {exp:structure:nav_sub} bug fix for empty list items in output
  • 1.2.5 5/6/2009
    • {exp:structure:nav_sub} rewritten
    • {exp:structure:nav_sub} when using start_from param now moves into 'fixed' mode
    • Bug fix: Windows host issue - \ was returned instead of / in get_site_path() function
  • 1.2.4 5/1/2009 - {exp:structure:sitemap} bug fix
  • 1.2.3 4/29/2009
    • New tag! {exp:structure:sitemap}
    • New tag! {exp:structure:page_slug}
    • {exp:structure:nav_main} new behavior: always hides entries with closed status
    • {exp:structure:nav_main} added id to each nav item (id="nav")
    • {exp:structure:nav_sub} new behavior: always hides entries & children below when status is closed
    • {exp:structure:nav_sub} new parameter "show_overview_link"
    • {exp:structure:nav_sub} new parameter "show_level_classes"
    • {exp:structure:breadcrumb} new parameter "uri"
    • Settings: added new warning when you try to erase Structure data
    • Updated the "No Structure data" message to be more informative and help setup an install
  • 1.2.2 4/21/2009
    • {exp:structure:nav_sub} new parameter start_from
    • Updated method to save settings: check is performed to see if setting was changed before executing ->delete_data_by_weblog()
    • Bug fix: clean up of potential PHP notice messages
  • 1.2.1 4/16/2009 - Bug fixes
  • 1.2 4/13/2009
    • Bug fix: tweak mechanism to include CSS files in CP - added get_site_path function to retrieve site path/directory based on site_url
    • Bug fix: tweak drag/drop Javascript for MSM - added site_path property to structure_settings javascript object
    • Bug fix: add publish tab interaction
    • Bug fix: hidden Structure tab in certain permissions (hidden vars for parent id)
    • Bug fix: automatically incrementing structure_uris (allows duplicate titles for entries)
    • Bug fix: move CSS/JS/IMG to themes folder under your default CP theme folder (Example /themes/default/structure/)
    • Bug/requirement fix: remove requirement of PHP v5.2+
      • added services/JSON.php
      • ajax_move_set_data needs json_encode (PHP v5.2+), added PHP 4 fallback alternative
  • 1.1.1 1/27/2009
    • LG Addon Support added
    • {exp:structure:breadcrumb} new parameters (via Aaron Gustafson @ easy-designs.net)
      • inc_separator to hide separator character
      • separator will include space around separator text automatically
      • wrap_here for here state customization
      • wrap_each alternate mode to make an unordered list
      • wrap_separator for greater separator customization
    • Bug fix: missing text in "last" class nav_sub items
    • Bug fix: 404 page no longer triggers "here" in nav_main
  • 1.1 1/15/2009
    • You can now select which weblogs Structure manages
    • New "Assets" feature for non structural entries managed by Structure
    • {exp:structure:nav_main} tag added
    • {exp:structure:paginate} container tag added
    • {exp:structure:titletrail} has new parameter "reverse" to change site & page order
    • {exp:structure:titletrail} "separator" parameter bug fix: now automatically padded, spaces weren't respected
    • {exp:structure:nav_sub} added class of "last" too all last children in a branch for an extra styling hook
    • structure_admin.tpl.php & structure_admin_settings.tpl.php - add/edit links now use BASE to create link
    • New functions use db_prefix variable/setting
    • When adding a listing weblog with existing entries Structure data is now created for each
    • When removing a weblog as a listing all Structure data is removed
    • Update procedure to auto-set weblogs with existing Structure data for the settings menu
  • 1.0.3 12/10/2008
    • {exp:structure:nav_sub} update: if all pages are hidden, empty ul is not generated
    • Fixed a MySQL bug that occurred when deleting an entry
    • Masked access compatibility: added PATH/system path to ext.structure_ext.php
    • {exp:structure:breadcrumb} new parameters:
      • inc_here to show current page or not
      • here_as_title to show page's title instead of "Here"'
    • {exp:structure:parent_title} tag added to return the current page's parent title
    • Reordering compatible with non-root installs (credit to Maurice Calhoun - mauricecalhoun.com)
  • 1.0.2 11/07/2008
    • URI bugs fixed
      • Accommodate the "/" URI entry for Home (no slug)
      • "/" now shows in the edit form once set so it will stay
      • Blanking out the URI field will rebuild the URI from the Title value using the Weblog/Section settings for dash or underscore
      • Changing the URI of a page with children and/or a listing will update all URIs
      • Reordering a page with children and/or a listing rewrites the URIs for all children and listings
    • {exp:structure:nav_sub} now creates CSS class names (sub-level-0) using the Weblog/Section settings for dash or underscore
    • {exp:structure:nav_sub} has new parameter "exclude_status" to hide any single or multiple user defined status
    • {exp:structure:nav_sub} uses site_index value to create the links, not just the root
    • {exp:structure:titletrail} tag added for title tags
    • MSM support added
      • added install/upgrade functionality
      • adds site_id column to exp_structure table
      • sets site_id for each Structure entry from exp_weblog_data
    • Settings button matches CP style
    • Improved visual feedback for dragging pages
    • Deleting from Structure update
      • Set status of "closed" on entries deleted by Structure
      • children will be marked as closed and removed from Structure
      • entries/listings will be removed from Structure only, status will not be changed
  • 1.0.1 9/25/2008 - Subnav tag nested li bug fix
  • 1.0 9/19/2008 - Released

Restrictions

Unless you have been granted prior, written consent from nGen Works, you may not:

  • Reproduce, distribute, or transfer the Software, or portions thereof, to any third party
  • Sell, rent, lease, assign, or sublet the Software or portions thereof
  • Grant rights to any other person
  • GPLv2 software has been used for the javascript in this module and do not carry to those portions