EllisLab text mark
Advanced Search
     
single entry display: require_entry=“yes” returning no results with seemingly valid URL
Posted: 03 August 2012 12:02 PM   [ Ignore ]
Avatar
Joined: 2011-12-31
11 posts

This question may be related to a resolved thread.

Hi,

I need help displaying a single entry! 

To display a single entry, I make use of the comment_url_title_auto_path feature as suggested in the above thread and other threads. This approach is successful for one channel (people) but not another channel (horses).  Both channels have several entries.

Here are some relevant Channel Preferences for the two channels People and Horses:

      People
          Channel URL =  http://mysite/community
          Comment Page URL = http://mysite/community

      Horses
          Channel URL = http://mysite/community/horses
          Comment Page URL = http://mysite/community/horses

The index page http://mysite/community uses conditional statements that depend on the segment variables to embed various templates.  On that index page there are two types of links:

{exp:channel:entries channel="people"}
 
<a href="{comment_url_title_auto_path}" title="Member Profile">{title}</a>
{/exp:channel:entries}
 
{exp
:channel:entries channel="horses"}
 
<a href="{comment_url_title_auto_path}" title="Horse Profile">{title}</a>
{/exp:channel:entries} 

The first points to something like http://mysite/community/example-person  The .second points to something like http://mysite/community/horses/example-horse.

Results for http://mysite/community/example-person:

      Here, segment_2 does not equal “horses”, so the site embeds a template that uses this tag

{exp:channel:entries channel="people" limit="1" require_entry="yes"}
 Member Profile content
{
/exp:channel:entries} 

As expected, the member profile content is displayed. 

Results for http://mysite/community/horses/example-horse:

Here, segment_2 equals “horses”, so the site embeds a template that uses this tag

{exp:channel:entries channel="horses" limit="1" require_entry="yes"}
 Horse Profile content
 {if no_results}
  
<p>Sorrywe got nuthin on this horse...</p>
 
{/if}
{
/exp:channel:entries} 

Unexpectedly, the no_results content is displayed.  Removing the require_entry and limit parameters will display all entries for the channel horses. 

Any help is appreciated! 

Thanks,

Luke

 
Posted: 03 August 2012 01:56 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2011-12-31
11 posts

OK, so here is an update. The problem seems to have something to do with how many segments are in the Channel URL and Comment Page URL in the Channel Preferences.  In the post above, the single entry Horse Channel is broken and does not display.  Call that Case A.

If I set the preferences like so (Case B):

    People
      Channel URL =  http://mysite/community
      Comment Page URL = http://mysite/community

    Horses
      Channel URL = http://mysite/horses
      Comment Page URL = http://mysite/horses

Then both channels work.  http://mysite/horses/example-horse will display a single entry.  http://mysite/community/example-person will display a single entry. 

Strangely, if I set the Channel Preferences like so (Case C):

    People
      Channel URL =  http://mysite/community/people
      Comment Page URL = http://mysite/community/people

    Horses
      Channel URL = http://mysite/community/horses
      Comment Page URL = http://mysite/community/horses

Then both channels are broken.  Neither http://mysite/community/horses/example-horse nor http://mysite/community/people/example-person will display a single entry.

I prefer the URL structure of Case A. Case C is also ok.  But Case B, which is the only case where both channels can display single entries, is least desirable. 

Any ideas why it should matter how many segments appear in the Channel URL and the Comment Page URL?

 
Posted: 06 August 2012 11:54 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2011-11-25
7174 posts

Hey Luke,

Thank you for posting your question here on the ExpressionEngine forums.

The Channel URL is going to be the URL of the channel, which in your case is http://mysite/horses and http://mysite/community. Anything added to that will not work because it’s not the root of the url, you are adding segments that do not exist.

Does that makes sense?

Unless you use dynamic=no, everything ExpressionEngine does is based on what is in the URL.

I hope that helps.

Cheers,

 Signature 

Recent version: EE 2.5.4 | Forum Module 3.1.10 | MSM 2.1.4 | 2.x Bug Tracker | Version Upgrade