With structure_entries, simply wrap all your display code with:{if {entry_id} != 32 || {entry_id} != 42}
I’ve tried that but it doesn’t seem to be working.
I’ve got this:
{exp:query sql="SELECT entry_id AS page_id FROM ee_weblog_titles WHERE url_title='{segment_1}'"}
{exp:structure_entries parent="{page_id}"}
{if {entry_id} != 409 || {entry_id} != 417 || {entry_id} != 421 || {entry_id} != 434}
Copied code goes here
{/if}
{/exp:structure_entries}
{/exp:query}I’ll add to the to-do list to add current_location=“on” or something to make it self aware and relevant to the current URL.
So does that it mean it can’t currently do what I mentioned in my previous post?
Tyssen,
The query call prior to the structure_entries call is redundant, this will do the same: {exp:structure_entries parent="/{segment_1}”}
In your conditional you want to use && not || (apologies, my example was incorrect).
Regarding addding current_location, no I meant I could expand it to be self aware of it’s current location.
Steven’s example is to use the current URL, without having to be specific with a segment variable or entry_id for the parent.
You can output the children by specifying the parent and depth in the current version of the plugin, that works as per my example test page.
But: “To show the adjacent pages to the one you’re on” - when you refer to adjacent, do you mean siblings or children?
Just in case anyone else has Florian’s issues, there were a couple of things…
The code was using {page_url} (which is the specific url segment of the page - like title_url) and should have been using {page_uri} - this should be consistent with Structure variables.
The EE install was in a subfolder, which doesn’t get output by the {page_uri} variable.
And finally the site uses index.php, which again was missing from the urls.
So all that was needed was to add “/subfolder/index.php/{page_uri}” to each link, or “{site_url}{page_uri}” (there may be a forward slash needed in there too!).
In your conditional you want to use && not || (apologies, my example was incorrect).
I did actually try that at some point and it didn’t work but must’ve changed some other part while trying different things out, but it’s all good now.
But: “To show the adjacent pages to the one you’re on” - when you refer to adjacent, do you mean siblings or children?
Yes, I mean siblings, but also the parent of that page and all the parent’s siblings too, so with a structure like below:
Parent 1 -Child 1.1 -Child 1.2 -Child 1.3 Parent 2 -Child 2.1 -Child 2.2 Parent 3 -Child 3.1 etc.
when on Child 2.2 you’d see
Parent 1 Parent 2 -Child 2.1 -Child 2.2 Parent 3
and when on Child 1.1 you’d see
Parent 1 -Child 1.1 -Child 1.2 -Child 1.3 Parent 2 Parent 3
and so on.
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="http://{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
{if {children_total} == 0 || {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="http://{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
{close_markup}
{if {total_children} == 0 || {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!
I migrated my dev site to Engine hosting and get this error:
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of runtime function name. If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in/www/eh13172/public_html/manage/plugins/pi.structure_entries.php on line 449Please 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.
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} == 0 || {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. :?
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} == 0 || {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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.