EllisLab text mark
Advanced Search
8 of 8
8
   
Plugin: Structure Entries - Add-on for Structure module
Posted: 08 July 2010 06:54 AM   [ Ignore ]   [ # 109 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

Easiest method might be simply hiding the redudant markup with CSS, using the example from the first post, you could hide all secondary <ul>‘s and then display the active parent…

#menu li ul { display:none; }
#menu .current ul {display:block; } 

Alternatively add some more conditionals:

{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} == || {current_parent} != true}{!-- No Children so close markup --}
    
</li>
  
{/if}

{if
:else}{!-- Children (not top level) --}
  {if {current_parent}}
  {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} 
== || {depth} == {restricted_depth}}
                    
</li>
    
{/if}
    {if {last_sibling} 
&& {sibling_count} == {sibling_total}}
                
</ul><!-- End of level{depth} closing tags -->
        </
li>
    
{/if}
  {
/close_markup}
  {
/if}
{
/if}
{
/exp:structure_entries} 

There’s two {current_parent} additions in the above - this isn’t tested, but should get you in the right direction!

 Signature 

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

 
Posted: 08 July 2010 07:58 AM   [ Ignore ]   [ # 110 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-02
885 posts

Yep, that’ll do it, thanks.

 Signature 

John Faulds — Owner Tyssen Design

 
Posted: 08 July 2010 01:54 PM   [ Ignore ]   [ # 111 ]   [ Rating: 0 ]
Joined: 2008-09-03
334 posts

I migrated my dev site to Engine hosting and get this error:

WarningCall-time pass-by-reference has been deprecated argument passed by value; If you would like to pass it by referencemodify the declaration of runtime function name. If you would like to enable call-time pass-by-referenceyou can set allow_call_time_pass_reference to true in your INI fileHoweverfuture versions may not support this any longerin/www/eh13172/public_html/manage/plugins/pi.structure_entries.php on line 449 
 
Posted: 08 July 2010 02:07 PM   [ Ignore ]   [ # 112 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

Please see post 2 Edit: http://ellislab.com/forums/viewreply/702031/

EDIT: Because of the PHP errors reported under PHP v5.0.3, this functionality isn’t enabled by default, so please download the version attached to this post.  To avoid getting the PHP error message, you’ll need to add the following to your PHP.ini (may need to search for it as it will probably already exist but set to false or off):
allow_call_time_pass_reference=true

This is so it can parse FieldFrame fields, but I’m working on a better method which will avoid this.

If you can’t edit the PHP.ini, then let me know and I’ll send a version which excludes this call.

 Signature 

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

 
Posted: 08 July 2010 03:25 PM   [ Ignore ]   [ # 113 ]   [ Rating: 0 ]
Joined: 2008-09-03
334 posts

I actually can’t edit PHP.ini. Ironically - I am using Expression Engine’s hosting service…

 
Posted: 08 July 2010 04:05 PM   [ Ignore ]   [ # 114 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

Here you go v1.0.11 without FieldFrame support and removes the PHP error message.

File Attachments
pi.structure_entries v1.0.11 without FF Support.zip  (File Size: 8KB - Downloads: 104)
 Signature 

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

 
Posted: 08 July 2010 06:47 PM   [ Ignore ]   [ # 115 ]   [ Rating: 0 ]
Joined: 2007-05-18
8 posts

Thanks for the fantastic plugin. Is it currently compatible with Structure 2.1.1 for EE2?

 
Posted: 08 July 2010 10:50 PM   [ Ignore ]   [ # 116 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-02
885 posts

Actually, I seem to be having a problem with a missing closing ul tag which is making that link and its children part of the previous links’ ‘family’.

{exp:structure_entries parent="/{segment_1}"}
    {if {entry_id} 
!= 409 && {entry_id} != 417 && {entry_id} != 421  && {entry_id} != 428 && {entry_id} != 434}
           {if {depth} 
== 1}<li{if {current_parent} || {current_page}} class="current"{/if}><a href="/site.php{page_uri}">{title}</a>{if {children_total} == 0}</li>{/if}
        {if
:else}
          {if {sibling_count} 
== 1}<ul>
        
{/if}
        
<li><a href="/site.php{page_uri}">{title}</a>{close_markup}{if {total_children} == || {depth} == {restricted_depth}}</li>{/if}
          {if {last_sibling} 
&& {sibling_count} == {sibling_total}}</ul>
        </
li>
        
{/if}
        {
/close_markup}
        {
/if}
    {
/if}
    {
/exp:structure_entries} 

The thing is, it only appears to be happening on one particular segment and not others. :?

 Signature 

John Faulds — Owner Tyssen Design

 
Posted: 09 July 2010 04:32 AM   [ Ignore ]   [ # 117 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

David:
No, it’s not EE2 compatible, now that Structure and various other add-ons have been released for EE2 I’ll now be using that as the main base for future development, although I will be trying out the other modules that are similar to Structure (one free, one commercial that I’m aware of). If Structure still works well compared to these, I’ll port the add-on to be compatible.  This will happen quite quickly I would have thought once I start on a fresh EE2 build.

Tyssen:
I think it’s to do with the if statements on the entry ID’s that are being skipped, if they’re the last sibling, it’s skipping the code to close them correctly.

{exp:structure_entries parent="/{segment_1}"}
           {if {depth} 
== 1}
    {if {entry_id} 
!= 409 && {entry_id} != 417 && {entry_id} != 421  && {entry_id} != 428 && {entry_id} != 434}
<li{if {current_parent} || {current_page}} class="current"{/if}>
<
a href="/site.php{page_uri}">{title}</a>{if {children_total} == 0}</li>{/if}
{
/if}
        {if
:else}
          {if {sibling_count} 
== 1}<ul>{/if}
    {if {entry_id} 
!= 409 && {entry_id} != 417 && {entry_id} != 421  && {entry_id} != 428 && {entry_id} != 434}
        
<li><a href="/site.php{page_uri}">{title}</a>
{/if}
{close_markup}
    {if {entry_id} 
!= 409 && {entry_id} != 417 && {entry_id} != 421  && {entry_id} != 428 && {entry_id} != 434}
{if {total_children} 
== || {depth} == {restricted_depth}}</li>{/if}
{
/if}
          {if {last_sibling} 
&& {sibling_count} == {sibling_total}}
</ul>
        </
li>
        
{/if}
        {
/close_markup}
        {
/if}

{
/exp:structure_entries} 

This is off the top of my head, and does now look messy.  If I get a chance today, I’ll look at the possiblity of adding an exclude parameter.

What I usually do though is create a category for navigation, and then call structure_entries passing the category, that way only those options assigned to the category appear.

Peter

 Signature 

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

 
Posted: 11 July 2010 10:32 PM   [ Ignore ]   [ # 118 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-02
885 posts

Yes, using categories would be a neater way of doing it, but in my case I’ve got lots of entries to show and only a handful to not show, so it’d be more useful for me to be able to do category_id=“not X” which doesn’t seem to work at the moment.

 Signature 

John Faulds — Owner Tyssen Design

 
8 of 8
8