I tried with your example 4 code again and I still only get the whole of the navigation menu shown
Yep - that’s what it’s suppose to do, I’ve changed it now so that by default it will output everything. If you specify depth=”1”, it will only output the top level, depth=”1” top level and it’s immediate children, etc.
I’ve updated the test page to show output of a parent menu (test 3)
Which is this code:
<ul>
{exp:structure_entries parent="31"}
<li><a href="/{page_url}">{title}</a></li>
{/exp:structure_entries}
</ul>If you use entry_id as the parameter (I’m assuming wrapped in weblog:entries tags), then it will only output the children of the current page. But I’m assuming from what you’re saying, you’re already on the child, so it won’t output anything.
To use the path instead of the parent entry_id, it must start with a forward slash or http://, otherwise it won’t recognise it as a correct url, so try: “/{segment_1}/{segment_2}/{segment_3}/”. Assuming that is the parent not the child!
As mentioned above, because this doesn’t output any markup, it can’t tell you if you’re on the current page, and you can’t use entry_id within the tag pair, as this will be the current id for whatever is being shown. But you can use page_uri which should match the last segment.
If this continues to be an issue without a nice template code solution, then I could probably introduce a boolean variable to identify the current page.
Any ideas on how to recreate class=”here”? Is there some voodoo with Structure and the segment variable I don’t get?
Just worked it out 😊
{exp:structure_entries depth="1" parent="7"}
<li{if '{exp:structure:page_slug}' == '{page_url}'} class="here"{/if}><a href="http://{page_uri}">{title} ></a></li>
{/exp:structure_entries}Another thing this is good for is creating a google sitemap from structure. Would be nice to include some type of exclude parameter like structure has so items I have set to a certain status do not get shown in the sitemap. Here is my template code for others.
<?xml version="1.0" encoding="UTF-8"?>
<urlset >
{exp:structure_entries depth="1"}
<url>
<loc>http://domain.com{page_uri}</loc>
<lastmod><?=date("Y-m-d",strtotime({edit_date}))?></lastmod>
<changefreq>monthly</changefreq>
0.5</priority>
</url>
{/exp:structure_entries}
</urlset>bryan2jumpstart: v1.0.5 now supports status (would you mind giving it a try please).
“closed” Status is now ignored by default, unless you specify status=”closed” in the parameter. Currently it only supports 1 status value (I’ll code it to handle multiples when I have more time!).
bryan2jumpstart:
Would be nice to include some type of exclude parameter like structure has so items I have set to a certain status do not get shown in the sitemap.
Also {status} can be pulled from within the tag pair, so you could build if statements to exclude anything…
{exp:structure_entries depth="1"}
{if "{status}" == "open"}
...
{/if}
{/exp:structure_entries}I’d like to create one template for listing the entries of any listing page. How can I figure out the weblog assigned to a particular listing page?
For example:
I have three weblogs called static_pages, news, and calculators. My site looks like this:
home (static_pages) about_us (static_pages) whats_new (static_pages) LISTING OF: news. our_calculators (static_pages) LISTING OF: calculators.
Is there a way to read Structure’s database to figure this out?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.