We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Structure Entries - Add-on for Structure module

Development and Programming

pab514's avatar
pab514
181 posts
15 years ago
pab514's avatar pab514

Hi, this is my first time using both structure and this plugin.

is it possible to replace exp:structure:nav_sub with a custom field to display the french titles,

basically what Im trying to do is replace the title of {exp:structure:nav_sub show_overview_link="yes"} so that the custom french field is displayed instead

right now when user is on the /fr/ subdomain instead of viewing all the translated subnav link (there’s a12 links) all the links are the same

we’re using levi’s multi language plugin to keep the translation in the same entry

I’ve included the code and two images.

Thanks

{if lg_lang == 'fr'}                         
                     {exp:structure_entries Parent={parent_id} }
<a href="http://{site_url}fr{page_uri}">  {title_fr}</a>
{/exp:structure_entries}
                {if:else}
{exp:structure:nav_sub show_overview_link="yes"
                    
                    rename_overview="Survol"} {/if}
       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

@pab514: Have responded on the support site.

       
running with scissors's avatar
running with scissors
149 posts
15 years ago
running with scissors's avatar running with scissors

is it possible to exclude a page based on it’s id? i have a couple of form thank you pages, one of which falls above my depth level.

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

@running with scissors: Yep - simply include an if statement within the structure_entries tag pair. Either page_url or entry_id should be sufficient (so don’t output markup if true).

       
running with scissors's avatar
running with scissors
149 posts
15 years ago
running with scissors's avatar running with scissors

ah, i should have thought of that. i guess i was too focused on a parameter type solution. thanks.

       
Bransin's avatar
Bransin
157 posts
15 years ago
Bransin's avatar Bransin

Note that page_uri variable doesn’t take into account if you haven’t yet removed index.php. The generated output would be http://exampleexample.com/level1/level2 which is a 404 if you haven’t removed your index.php.

A way around this problem

<a href="http://{path={page_uri}}">{title}</a>
       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

New version available (v1.0.7) in the first post, with switch variable added and new {close_markup} variable pair which loops through all parents of the current entry allowing you to add the appropriate markup. The 4th example in the first post has been updated to demonstrate this.

By default the version has the code included to parse FieldFrame fields, I’m still working on a better fix, if you get PHP errors, post 2 on this thread explains how to get rid of it, or let me know and make a version available which has it disabled.

Peter

       
Bransin's avatar
Bransin
157 posts
15 years ago
Bransin's avatar Bransin

Found a bug. It seems {current_page} matches with the last uri segment and returns true or false.

I have two pages named the same but with different hierarchy. The output results in 2 trues instead of one.

{if {current_page} == 1} class="active"{/if}
       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

LOL - trying to be clever I added an if statement to mark current_page on the parents as well as the child.

Failed.

I’ve stripped the code out and re-uploaded. Will have to think about how to do it properly next time :(

       
NobleStudios's avatar
NobleStudios
2 posts
15 years ago
NobleStudios's avatar NobleStudios

in navigation code similar to this example:

{exp:structure_entries depth="2"}
  ..
  ..
  {if {last_sibling}}
    </ul><!-- End of level{depth} -->
  {/if}
{/exp:structure_entries}

The code breaks when one of the siblings at this level is set to status = closed. Has anyone else experienced similar results?

Is this a known bug, or is there another way to determine that sibling#3 is the final sibling when sibling#4 is closed? Or would the solution require that I use a new status group? using Structure Entries v.1.0.5

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

Hi, by default it will try to process all status values, so I suggest you add the status parameter, so:

{exp:structure_entries depth="2" status="open"}

I’d also suggest you try using the latest version 1.0.7c on the first post, and use the new “close_markup” variable pair instead as the original method had a bug if a final child had multiple children. The C increment includes the correct example code in the supporting documentation (example also included in the first post).

When you say the code “breaks” - what happens? The output stops, no output at all, error message?

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

New version 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 (ancestry) of current page

Please note: I haven’t been able to fully test these changes so let me know if there are any issues!

       
Bransin's avatar
Bransin
157 posts
15 years ago
Bransin's avatar Bransin

Does this version have the fix for the {current_page} variable?

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

Hopefully!

There’s a new variable called {current_parent} which ‘should’ output true when it’s the parent (or ancestor) of the current page. I haven’t got a current setup to fully test this working yet.

This has been kept seperate to {current_page} in case the parent is selectable itself and you may want to assign a different class for the 2 modes (as in it’s selected or it’s child is selected).

       
Bransin's avatar
Bransin
157 posts
15 years ago
Bransin's avatar Bransin

I used the navigation example #4. For some strange reason my <ul> tag is not closing properly. Within Structure I’ve moved hierarchy around trying to solve this problem. As you can see the depth and parent reflects accurately but the <ul> tag doesn’t close under parent 409. See attached screenshots for the output example.

The same navigation code works elsewhere throughout the site except under this particular section. Any clue of what might be causing this?

<div id="pageNav">
<ul>
<li><a href="/dining/maxwells-at-the-club/">Maxwell's at the Club Depth=1 Parent=392</a></li>
<li><a href="/dining/grill/">Grill Depth=1 Parent=392</a>
     <ul class="level2">
     <li><a href="/dining/grill/breakfast-menu/">Breakfast Menu Depth=2 Parent=396</a></li>
     <li><a href="/dining/grill/lunch-dinner-menu/">Lunch & Dinner Menu Depth=2 Parent=396</a></li>
     <li><a href="/dining/grill/general-information-grill/">General Information Depth=2 Parent=396</a></li>
     <li><a href="/dining/grill/contact-grill/">Contact Depth=2 Parent=396</a></li>
     </ul><!-- End of level2 closing tags -->
</li>
<li><a href="/dining/food-shop/">Food Shop Depth=1 Parent=392</a>
     <ul class="level2">
     <li><a href="/dining/food-shop/catering/">Catering Depth=2 Parent=409</a></li>
     <li><a href="/dining/food-shop/smart-meals/">Smart Meals Depth=2 Parent=409</a></li>
     <li><a href="/dining/food-shop/food-shop-general-information/">Food Shop General Information Depth=2 Parent=409</a></li>
     <li><a href="/dining/food-shop/contact-food-shop/">Contact Depth=2 Parent=409</a></li>
     <li><a href="/dining/juice-bar/">Juice Bar Depth=1 Parent=392</a>
  
<ul class="level2">
     <li><a href="/dining/juice-bar/menu/">Menu Depth=2 Parent=445</a></li>
     <li><a href="/dining/juice-bar/juice-bar-general-information/">Juice Bar General Information Depth=2 Parent=445</a></li>
     <li><a href="/dining/juice-bar/contact/">Contact Depth=2 Parent=445</a></li>
     </ul><!-- End of level2 closing tags -->
</li>
<li><a href="/dining/sundeck-cafe-pool-bar/">Sun Deck Cafe & Pool Bar Depth=1 Parent=392</a>
     <ul class="level2">
     <li><a href="/dining/sundeck-cafe-pool-bar/sundeck-poolbar-menu/">Menu Depth=2 Parent=417</a></li>
     <li><a href="/dining/sundeck-cafe-pool-bar/sun-deck-general-information/">Sun Deck General Information Depth=2 Parent=417</a></li>
      </ul><!-- End of level2 closing tags -->
</li>
<li><a href="/dining/private-events-banquets/">Private Events & Banquets Depth=1 Parent=392</a>
     <ul class="level2">
     <li><a href="/dining/private-events-banquets/menus/">Menus Depth=2 Parent=421</a></li>
     <li><a href="/dining/private-events-banquets/room-layouts/">Room Layouts Depth=2 Parent=421</a></li>
     <li><a href="/dining/private-events-banquets/photo-gallery/">Photo Gallery Depth=2 Parent=421</a></li>
     <li><a href="/dining/private-events-banquets/parking/">Parking Depth=2 Parent=421</a></li>
     <li><a href="/dining/private-events-banquets/general-information-private-events/">General Information Depth=2 Parent=421</a></li>
     <li><a href="/dining/private-events-banquets/contact-private-events-banquets/">Contact Depth=2 Parent=421</a></li>
     </ul><!-- End of level2 closing tags -->
</li>
</ul> 
</div>
       
First 3 4 5 6 7 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.