“Other entries from same author” functionality
Posted: 01 December 2008 04:33 PM   [ Ignore ]  
Summer Student
Total Posts:  3
Joined  11-16-2008

On a weblog entry page, I’m trying to list other entries by the same author as the one that’s being viewed. However I cannot seem to be able to nest weblog tags in a way that works.

I need to accomplish something like this:

{exp:weblog:entries weblog="my_weblog"}
  
<h2>{title}</h2>
  
{body}
  
<hr/>
  <
h2>Other entries by {author}</h2>
  <
ul>
    
{exp:weblog:entries weblog="my_weblog" author_id="{author_id}" limit="5"}
      
<li>{title}</li>
    
{/exp:weblog:entries}
  
</ul>
{/exp:weblog:entries}

Thanks!

Profile
 
 
Posted: 01 December 2008 09:58 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  430
Joined  02-26-2008

You shouldn’t nest weblog:entries like that.  I would suggest using an embed template here.

On a single entry page, add:

{exp:weblog:entries weblog="my_weblog"}
  
  {embed
="includes/authors" author="{author_id}"}

{
/exp:weblog:entries}


Then, your embedded template might look like:

{exp:weblog:entries weblog="my_weblog" author_id="{embed:author}" limit="5"}

   {title}

{
/exp:weblog:entries}

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66391 Total Logged-in Users: 46
Total Topics: 84714 Total Anonymous Users: 13
Total Replies: 454694 Total Guests: 177
Total Posts: 539408    
Members ( View Memberlist )