Thursday, 9 October 2008

Expressionengine related articles code

Just found out a way of doing related entries in a slightly nicer way than just (In same category, latest first).
Use track_views and get counts for weblog entries not just templates. you can then sort buy the view count, giving you the most read stories.

It is not ture related articles but at least it is most popular articles in a category, and it will keep updating, but not jump as much as sort by date.

You can remove the {view_count_one}, just for effect.

Single Entry page: (you will need to look at the source)

{exp:weblog:entries weblog="{weblog_name}" orderby="date" sort="desc" limit="1" track_views="one"}
{title}
--{view_count_one}
{/exp:weblog:entries}

{!-- Followed by --}
{exp:weblog:entries related_categories_mode="on" limit="3" orderby="view_count_one"}
{if count == "1"}

Related Articles



{/if}
{/exp:weblog:entries}

No comments:

Post a Comment