Extension, Module

Archived
Forum
(read-only)


For official support, visit the official support site »

Structure

ExpressionEngine 1.x, ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Tom Jaeger

     

Structure to ignore a segment, but allow EE to pick it up

Feature Request

Sy
Sy

I have been using structure for some time and love it. But I have come across a problem where I need to have some advanced functionality on a page which has content, dynamic listings and forms. My way of working with this is to create a template with the same URL as the structure page. This way the page can be edited via Structure where links and navigation can be created accordingly.

However because the way Structure works is that it picks up the URL before EE and outputs page content correctly but limits the template functionality I need. One work around I have found is to change the Structure Page URL (I simply add a “.” Or “_” before the name), which then displays the EE template. However then the Structure links and navigation point to this renamed page.

I have tried Freebie however this disables the segment completely and is not seen by EE either (it seems by changing the routing).

I don’t think there is a way to write an another extension for this, otherwise I propose an additional feature where Structure would ignore selected pages. This could simply be a checkbox with “Ignore page” within Structure. This would enable substituted template pages to render as normal. This could probably be done by searching the $this->site_pages array in and removing the excluded URI from this (within sessions_start in Structure_ext).

I’d be interested to know what you think.
Thanks

rockthenroll
# 1
Developer
rockthenroll

Not sure I understand fully what isn’t working - you shouldn’t need extra templates. If you want to call content that is not directly related to the current URL, you use a channel tag with dynamic=“no” so that it grabs the info from whatever other channel you specify. Does that help?

Sy
# 2
Sy

Sorry if I was quick to request a new feature. Thanks but I’ve tried that, I’ll try to explain and perhaps you could help me.

Current setup:
The page content is specified with the url_title=”my_page” and edited edited Structure which also contains listings
The listing is set to dynamic dynamic and has pagination
The listing and pagination works IF Structure Page URL is changed to something other than the what is in the URL (in this case I prefixed the Structure Page URL with a “.” which bypasses structure and uses the native template).

There are also sub pages with content including articles linked from the listing,  post forms and comment forms. Obviously the structure urls for these sub pages would fall under the parent page which would be incorrect in my case (unless I do the same and get it to display the template instead by renaming the structure url).

I changed to your suggestion where:
Page content is set to dynamic
Listing is set to dynamic=”no”

The problem I have now is:
Page content displays ok as expected from Structure
The sub pages URLs are correct
The first page listing displays ok
The pagination links don’t work as expected
I’ve tried Freebie which doesn’t seem to solve the problem (as described here http://devot-ee.com/add-ons/support/freebie/viewthread/2028/)

My thinking was if structure could ignore displaying this page then the template could display it and render as normal?...

If this still stands perhaps a hook can be added to alter the array of pages structure uses to display it’s content?

rockthenroll
# 3
Developer
rockthenroll

Our pagination will probably not work off a Freebie segment because the URL doesn’t actually exist (meaning we can’t account for it). Right now, we have no way around this because we can’t find out the URL, but possibly down the road.

Sy
# 4
Sy

Ok, I created a work around though it meant me adding a hook. The approach I took is by adding this hook to ext.structure.php within session_start function (just below the first if statement) and created an extension which returns the all the pages as is, or FALSE if it finds a URI that I have specified in an “ignore” list. If FALSE is returned then the page is ignored by Structure and rendered as normal by EE, which works fine for the now.

rockthenroll
# 5
Developer
rockthenroll

Sounds like a good solution!