Think I know what you’re after, “whats_new” would list out all the entries in news?
I use segment_1 to identify the weblog, then just place “weblog=”{segment_1}” as a parameter in {exp:weblog:entries}.
But in your case this would be more suitable - a series of if statements in your index template that link to a shared embed:
{if segment_1 == "whats_new"}
{embed=includes/listing weblog="news"}
{if:else segment_1 == "our_calculators"}
{embed=includes/listing weblog="calculators"}
{/if}Then in your embed “listing” template:
{exp:weblog:entries weblog="{embed:weblog}" disable="member_data|pagination|trackbacks" dynamic="off" }
...The structure entries plugin doesn’t list out child listing pages.
That’s exactly my goal. However, I wanted to do this without having to maintain the if/else template. Since my post, I’ve created this, maybe someone else will find it useful. It will continue to work even if the url_title of the listing page is changed, or even if the weblog to list is changed.
Now, to list the entries for a structure listing page, just embed _list-folder.
<!-- file: _list-folder -->
{exp:weblog:entries}
<?php
// process php on output
/*
This query works with the Structure module.
For a listing page, it looks up the name of the associated weblog to list.
Because we need to process results by EE, we call an embed.
*/
$sql_query = <<<EOT
SELECT blog_name AS sql_results
FROM exp_weblogs AS w
INNER JOIN exp_structure AS s
ON w.weblog_id = s.listing_wid
AND s.entry_id = '{entry_id}'
EOT;
?>
<!-- sql_query=<?=$sql_query?> -->
{embed="includes/_list-folder2" tQuery="<?=$sql_query?>"}
{/exp:weblog:entries}The second file runs the query to figure out the weblog name, then lists the results.
<!-- file: _list-folder2 -->
{exp:query sql="{embed:tQuery}"}
<!-- sql_results={sql_results} -->
<ul class="list-weblog-{sql_results}">
{exp:weblog:entries weblog="{sql_results}" dynamic="off" disable="categories|member_data|pagination|trackbacks|comments"}
<li {if count==total_results}class="last" {/if}>
<a href="http://{page_url}">{title}</a>
<div>{description}</div>
</li>
{/exp:weblog:entries}
</ul>
{/exp:query}I wish there were a Structure tag that would return the name of the weblog to list, so I could avoid the PHP complexity. Or I wish there were a way to make this work in a single file.
Anyway, maybe this will help the next person. Or someone will see this and point out a better way of doing it.
Had a temporary request (it was removed from the support site before I could reply!) for the parsing of FF Matrix fields. This can be done quite easily, and works fine on my builds and for other testers, so I will be re-introducing in the next version. In the meantime, send me a PM and I’ll send you a version with FFMatrix parsing activated.
Greetings,
I am developing a site and am using EE for the first time. Absolutely love Structure, but the default menu layout will not work for me this time. I’m trying to figure out how to do this using the plugin, but the syntax is new to me and I can’t get it to work.
This is for a subnav that appears in a sidebar on every page but the homepage. The layout should be pretty standard. The site structure is like most:
I) Section Head i) Subpage 1 ii) Subpage 2 iii) Subpage 3 II) Section Head 2 i) Subpage 1 ii) Subpage 2 iii) Subpage 3
What I want is for only the current section to display when on one of the subpages.
I would use the standard Structure nav, but I don’t want the top level to appear as part of a <ul>. That won’t work with the way I’m styling the nav.
Thanks in advance for the help!
Gabriel
Greetings, I) Section Head i) Subpage 1 ii) Subpage 2 iii) Subpage 3 II) Section Head 2 i) Subpage 1 ii) Subpage 2 iii) Subpage 3 What I want is for only the current section to display when on one of the subpages. I would use the standard Structure nav, but I don’t want the top level to appear as part of a <ul>. That won’t work with the way I’m styling the nav. Gabriel
You could try just using the built in structure function:
{exp:structure:nav_sub start_from="/{segment_1}/{segment_2}”}
Note that you may need to add some a condition to check whether your on a section head vs a subpage. Of course, if your pages use separate templates (or separate embeds), that would be easy implementation.
I) Section Head i) Subpage 1 ii) Subpage 2 iii) Subpage 3 II) Section Head 2 i) Subpage 1 ii) Subpage 2 iii) Subpage 3 What I want is for only the current section to display when on one of the subpages.
The following should build your menu, using h3 for the top level items instead of ul & li, which are only used for the lower level:
{exp:structure_entries depth="2"}
{if {depth} == 1}{!-- Top Level --}
<h3>{title}</h3>
{if {children_total} > 0}{!-- Has Children --}
<ul{if "{segment_1}" != "{page_url}"} class="hide-menu"{/if}>
{/if}
{if:else}{!-- Children --}
<li>{title}</li>
{/if}
{if {last_sibling}}{!-- Last Child - so close markup --}
</ul><!-- End of level{depth} -->
{/if}
{/exp:structure_entries}Then add this CSS:
ul.hide-menu {
display:none;
}This assumes that {segment_1} is the url_title from the top level items of your menu.
At the moment, I’m sort of hacking Structure to give me the effect of a menu with classes ‘here’ and (effectively) ‘ancestor_of_here’. I use it to highlight the path through the menu from the root to the current page.
Is that something that Entries could do, or does it need something analogous to current_page to find parents of current_page?
hi there, thanks for this plugin! I think it does it’s job perfectly.
there is one thing that I am missing, or that I am not aware of how it can be achieved: I would like to be able to display next and previous entries.
I looked over your variables and coudn’t find anything to achieve this. maybe something like {next_child} or {previous_child} would make sense… or something like: {exp:structure_entries:next_child} {exp:structure_entries:previous_child}?
cheers stefan
As structure_entries loops through all the children, not just displaying a specific one, why would you want to display next_child/previous_child?
Edit: Re-reading your post, I understand now - it’s a separate tag you want to output, when you’re showing an individual page. Can’t see the sense in putting it as part of the main entries loop, so will add seperate templates tags for these.
And what would they output? URL? Title?
Could you give an example of what you’re intending to do and I might be able to help you better.
I actually second this request: i’d like a next-child/prev-child based on the current page if possible. Because Structure entries DO have an order, and it’s damn difficult to get the prev/next one out of Structure itself.
I’d personally like it to output url and title.
Adrienne
I actually second this request: i’d like a next-child/prev-child based on the current page if possible. I’d personally like it to output url and title.
maybe the entry_id or url_title of the next / prev entries would be helpful aswell… this was a clients request. but I can think of other applications…
maybe someone has a sql queries snippet to share?
cheers stefan
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.