EllisLab text mark
Advanced Search
     
List entries from same category
Posted: 13 August 2012 06:22 PM   [ Ignore ]
Joined: 2010-06-14
16 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="{title_permalink='blog'}">{title}</a>
    </
li>
  
{/exp:channel:entries} 

help?

 
Posted: 13 August 2012 08:00 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-11-29
101 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

 
Posted: 14 August 2012 07:08 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-09-20
1046 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.

 Signature 

+++

QB Marketing
Vision + Design
url: http://www.qbmarketing.com