ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

unrelated channel entry not showing in category URL

September 29, 2012 4:10pm

Subscribe [1]
  • #1 / Sep 29, 2012 4:10pm

    Sven T.

    21 posts

    Hi

    I am showing one channel entry in the upper part of every page, the “page hero”... I do this through embeding a template and calling the channel:

    {exp:channel:entries channel="the_page_hero" limit="1" dynamic="no" entry_id="1" disable="categories"}
     <h1>{title}</h1>
     {hero_message}
     <a href="http://{hero_link}">Read More</a>
    {/exp:channel:entries}

    it works perfectly well unless I have a URL with a category like segment.

      http://mysite.com/index.php/blog/post/some-url-title <—- works
      http://mysite.com/index.php/blog/post/some-url-title/C4 <—- Does not work

    What am I’m missing here?

     

  • #2 / Oct 01, 2012 12:56pm

    Dan Decker

    7338 posts

    Hi Sven,

    You are giving ExpressionEngine conflicting information.

    The disable parameter tells ExpressionEngine to ignore any category information, so example 1 works just fine.

    In example 2 you are triggering ExpressionEngine’s category mode with the C4 trigger in the URL, but you’ve told Channel Entries to ignore category information with the disable par mater. Essentially, you’ve asked EE to get all entries in category ID 4, but have then told it to completely ignore categories.

    See the conflict?

    Can you tell me a bit about what you are wanting to do? I’d love to help you get the result you are looking for.

    Cheers,

  • #3 / Oct 01, 2012 1:27pm

    Sven T.

    21 posts

    Hey Dan,

    no I don’t see the conflict. 😊

    I want to get a channel entry - I don’t care about categories. (this channel doesn’t even have categories). I don’t care about the URL. All I care about is that I tell the tag to select a certain channel, and return one result. Thus the switch dynamic=“no”. Thus the order to disable categories.

    I also tried entry_id=x, and url_titel=“xyz” - EE refuses to output anything just because it sees a “C4” in the uri and starts making assumptions. (Which I explicitly ask EE not t do here - do I?)

    To give you a better context of the situation:

    I have a pice of information that goes on EVERY page on that website. The user wants to be able to edit this from the backend. So I created a channel with exactly one entry. And thats the entry I am requesting here.

    Works on all pages, _except_ the blog section where a totally unrelated channel is linked to a totally unrelated category group. Thus the “C4” in the uri.

    I don’t quite see why a “C4” or “Whatever” in the uri string keeps me from getting correct results from a channel? Doesn’t that sound like a bug to you?

    It does to me, the more because in the end I was able to solve it by changing the “Global Channel Preferences” > “Use Category URL Titles In Links?” => YES

    How is using “category/url_title” instead of “C4” even related to getting an entry from another channel?

    Shall I file a bug report or will take it from here?

     

     

  • #4 / Oct 02, 2012 11:03am

    Dan Decker

    7338 posts

    Sven,

    What version of ExpressionEngine are you using?

    Have a look at this bug report, it sounds similar to your experience.

    There is a solution in the report, but being up-to-date to ExpressionEngine 2.5.3 is the recommended fix.

    Cheers!

  • #5 / Oct 02, 2012 11:49am

    Sven T.

    21 posts

    Thanks Dan

    Looks like what I am experiencing.  I am on 2.5.2…btw.

    As I said - I could fix it by changing the “Global Channel Preferences” > “Use Category URL Titles In Links?” => YES - and it works fine right now.

    But I might as well update to 2.5.3 soon

    Thanks again

    Sven

  • #6 / Oct 03, 2012 3:19pm

    Dan Decker

    7338 posts

    Hey Sven,

    If you are feeling up to it, you can apply the fix outlined in the report. That would be the same code used in 2.5.3 and would save you the extra time of updating.

    Is there anything else I can do for you?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases