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.

List entries from same category

August 13, 2012 6:22pm

Subscribe [3]
  • #1 / Aug 13, 2012 6:22pm

    Eric_WVGG

    10 posts

    I have an entry at a page (/blog/some-article), and I need to list other entries from its categories.

    I’ve gotten this far, but whatever script limits the page to the single article is also limiting this query. In other words, it only returns “some-article” (the only result I *don’t* want).

    {exp:channel:entries channel="blog" category="1" limit="4"}
        <li>
          <a href="http://{title_permalink=blog}">{title}</a>
        </li>
      {/exp:channel:entries}

    help?

  • #2 / Aug 13, 2012 8:00pm

    Nelly

    94 posts

    Use dynamic=“no” in the list of other entries, so your entry tag is not affected by the URL.

    {exp:channel:entries channel="blog" category="1" limit="4" dynamic="no"}

    More information here

  • #3 / Aug 14, 2012 7:08am

    John St-Amand

    865 posts

    Even with dynamic=“no” added to your entries loop, to remove your current blog entry from the list, you will need to add a parameter to exclude the current entry from the list to avoid that duplication, such as entry_id=“not #” (using the current entry’s ID, for example).

    There’s a pretty good quick-read on category-related entries in the Viget blog that you may find useful as well.

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

ExpressionEngine News!

#eecms, #events, #releases