EE2 Ready Add-ons »

Plugin

EE 1
EE 2
Structure Entries

Developer

Twobelowzero

3rd Party (Free)

Creative Commons Attribution No Derivatives

Compatibility

  • LG Addon Updater
  • Multi Site Manager
  • Stand Alone Entry Form

Requirements

  • jQuery for the Control Panel
  • Hermes

Extends the excellent Structure module with a tag pair that allows you to output your Structure managed pages with your own html markup, with control on the depth of parent/child and is completely independent of weblog:entries (doesn’t sit inside {exp:weblog:entries} tag). It also supports categories and FieldFrame.

Requires Structure to be installed!

Now with full FieldFrame and Matrix support built-in - no more hacking FieldFrame!

This can be used to output a menu, summary of a group of pages, bullet points on screen, whatever.

Code:

{exp:structure_entries 
     depth="2" parent="10" category_id="7" limit="4"}
...
Your html markup and EE Fields.
...
{/exp:structure_entries}

It’s a tag pair, so always needs the closing tag. All parameters are optional, defaults are shown below.

Parameters:

  • depth - to restrict how deep the output is (defaults to 0 - all)
  • parent - to only show the children beneath the specified parent (including grand-children, etc).  This can be either the entry_id of the parent or the path to the parent. For multiple entry_id’s separate with “|”.
  • category_id - the category ID that you want shown - only entries (including children) assigned to the specified category will be shown.
  • limit - restricts the output so only the amount of pages you specify will be shown (handy for summary pages, where you might only want to show a few of the child pages). Default is unlimited.
  • status - limit output to a specific status (can only handle one status), by default outputs all status except “closed”.
  • convert_html - parses output to convert relevant characters to HTML entries (e.g. ‘&’ becomes ‘&’), default is false.
  • parse=“inward” - this is a built-in EE parameter which will parse this plug-in before processing any add-ons within (e.g. imgsizer, word_limit)

Variables:

Additional variables available (beyond the standard EE fields and custom fields) include:

  • {page_uri} = Is the entry URL value
  • {page_url} = Is the URL to the entry as returned by Structure
  • {current_page} = returns 1 (true) if the current page matches the page output by the entries loop
  • {depth} = Displays the current level of pages deep this page is (how many parents it has)
  • {parent_id} = Entry ID for the parent of the current page, if it’s top level, it returns 0
  • {count} = running counter for all entries that match the supplied parameters
  • {total_children} or {children_total} = Total entries that match the supplied parameters (depth, parent & category)
  • {last_child} or {last_sibling} = Returns true or false boolean to indicate if the entry is the last sibling in the current group and level of entries
  • {sibling_count} = running counter of siblings working through the current group at the same level
  • {total_siblings} or {sibling_total} = total siblings for the current group at this level

Example Code:

Example 1 (very basic):

{exp:structure_entries}
  {title}
{/exp:structure_entries}

Which will list all structure entries (any depth/level) and any fieldname/variable specified within the template tags will be shown.
FF Matrix is supported with a very minor amend to the FieldFrame code.

Example 2:

{exp:structure_entries parent="10" depth="1"}
  <li><a href="{page_uri}"><img src="{theme-url}/images/{page_url}.gif" alt="{if " /></a></li>
{/exp:structure_entries}

Displays the children (1 level) of a specific parent, using images and custom fields as an alternative to {title}.

Example 3:

{exp:structure_entries category_id="6" depth="1"}
  <li><a href="{page_uri}">{if "{alternative-title}" != ""}{alternative-title}{if:else}{title}{/if}</a></li>
{/exp:structure_entries}

Similar to example 2, but defined by a category.

Example 4:

{exp:structure_entries}
{if {depth} == 1}{!-- Top Level --}
    <li {if {current_parent}}class="current"{/if}{if {current_page}}class="active"{/if}>
        <a href="{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
  {if {children_total} == 0}{!-- No Children - so close markup --}
    </li>
  {/if}

{if:else}{!-- Children (not top level) --}
  {if {sibling_count} == 1}{!-- First child - so open markup --}
        <ul class="level{depth}">
  {/if}
            <li {if {current_parent}}class="current"{/if}{if {current_page}}class="active"{/if}>
                <a href="{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
  {close_markup}
    {if {total_children} == 0 || {depth} == {restricted_depth}}
                    </li>
    {/if}
    {if {last_sibling} && {sibling_count} == {sibling_total}}
                </ul>
        </li>
    {/if}
  {/close_markup}
{/if}
{/exp:structure_entries}

This displays multiple levels with custom markup based on a category.

Change log

v1.0.8   Fix for status, default if no status specified is != ‘closed’
      Fix for EE update (v1.6.9) - page URI
      Added new variable {current_parent} which is set to true if parent of current page
v1.0.9   Fix for current_parent variable not working!  Tsk!
v1.0.10 Bug fix for limiting depth and close markup not closing parents with deeper children
      Added encoding of output (htmlentities and category variables parsed with htmlspecialchars)
v1.0.11 License change
v1.0.12 Added new parameter for converting special characters to html entities, added parse=“inward” to documentation
v1.0.13 Added parent=“current” parameter
v1.1.0 Re-written the FieldFrame parsing
v1.1.1 Added multiple parentID’s

Download Structure Entries

EE Version Downloads Add-On Version Release Date
1.x Download 1.1.1 08/17/2010
2.+ Download 1.2.0 08/31/2010

Structure Entries Links

This entry was last updated August 31, 2010, 6:23 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. Devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

1 Review:

Bransin 04.17.10

54321

It would be nice if Structure and this plugin were combined. Before I knew of this plugin, the output HTML Structure provided was not exactly what I had in mind. This forced me to change a lot of CSS to work with the new generated markup.

Great plugin, and must have for any complex site!