3 of 7
3
Plugin: Structure Entries - Add-on for Structure module
Posted: 28 January 2010 02:16 PM   [ Ignore ]   [ # 37 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

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!).

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 28 January 2010 02:38 PM   [ Ignore ]   [ # 38 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

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} 
 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 28 January 2010 04:15 PM   [ Ignore ]   [ # 39 ]  
Lab Assistant
RankRank
Total Posts:  111
Joined  02-05-2009

Yeah that’s what I did after the fact, nice plugin

 Signature 

JumpStart Web Services

Profile
 
 
Posted: 28 January 2010 08:15 PM   [ Ignore ]   [ # 40 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  232
Joined  06-12-2002

Just a quick question: is this for Structure 2 only, or will it work on the older free version (1.x) as well?

Adrienne

Profile
 
 
Posted: 29 January 2010 12:00 AM   [ Ignore ]   [ # 41 ]  
Lab Assistant
RankRank
Total Posts:  111
Joined  02-05-2009

Using it on 1.3.1 right now

 Signature 

JumpStart Web Services

Profile
 
 
Posted: 29 January 2010 01:47 PM   [ Ignore ]   [ # 42 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  232
Joined  06-12-2002

Excellent! Thanks for the info, bryan2jumpstart—this will solve a TON of problems for me with one particular client site (which i can’t upgrade to 2.0 because it’s a large MSM site and the cost is prohibitive. Otherwise i totally would. Sigh.)

Profile
 
 
Posted: 22 February 2010 12:37 PM   [ Ignore ]   [ # 43 ]  
Summer Student
Total Posts:  9
Joined  02-02-2009

Fantastic! Thanks for this great job! I dreamed about - you’ve make it : )

Next dream… beautiful blond girl in my dev team? : )

Profile
 
 
Posted: 24 February 2010 02:46 PM   [ Ignore ]   [ # 44 ]  
Summer Student
Total Posts:  22
Joined  05-20-2009

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?

Profile
 
 
Posted: 25 February 2010 04:54 AM   [ Ignore ]   [ # 45 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

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.

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 25 February 2010 02:41 PM   [ Ignore ]   [ # 46 ]  
Summer Student
Total Posts:  22
Joined  05-20-2009

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="{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.

Profile
 
 
Posted: 25 February 2010 05:36 PM   [ Ignore ]   [ # 47 ]  
Summer Student
Total Posts:  22
Joined  05-20-2009

Oh, I just realized that the count=total_results in the code above doesn’t work to correctly apply the “last” class to the LI tag. The variables are set to 1 by the outer exp:query. It would require another level of embedding to fix this.

Profile
 
 
Posted: 05 March 2010 10:22 AM   [ Ignore ]   [ # 48 ]  
Summer Student
Total Posts:  29
Joined  07-31-2008

First of all, really nice plugin…
Only having one problem, im trying to build dropdown nav and it’s working almost ok but when i’m on a child page I want that the parent gets an class current.
How can this be achieved?
I’m using structue 2.0.8..

 Signature 

My blog about Bingocams

Profile
 
 
Posted: 05 March 2010 10:44 AM   [ Ignore ]   [ # 49 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

Can you tell the current parent via the url?  e.g. on the loop that outputs the parent can you compare {page_url} to {segment_1}?

Obviously {current_page} only indicates the specific page.

If you can’t solve, drop me an email and I’ll try and code something for you.

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 19 March 2010 12:14 PM   [ Ignore ]   [ # 50 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

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.

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 22 March 2010 03:03 PM   [ Ignore ]   [ # 51 ]  
Summer Student
Total Posts:  1
Joined  02-18-2010

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

Profile
 
 
Posted: 25 March 2010 08:21 PM   [ Ignore ]   [ # 52 ]  
Grad Student
Avatar
Rank
Total Posts:  36
Joined  04-21-2009
GabrielZ - 22 March 2010 07:03 PM

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.

 Signature 

Jarrett M. Barnett
Web Development
MC2 Design Group, Inc.

.(JavaScript must be enabled to view this email address)
http://www.mc2design.com
http://www.linkedin.com/in/jarrettbarnett

Profile
 
 
Posted: 25 March 2010 08:47 PM   [ Ignore ]   [ # 53 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  308
Joined  10-17-2007

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.

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 29 March 2010 11:52 PM   [ Ignore ]   [ # 54 ]  
Summer Student
Avatar
Total Posts:  20
Joined  10-12-2008

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?

Profile
 
 
   
3 of 7
3