Hi all,
On the news detail page for each article I'm trying to display a news article in detail and then all other News articles in the same category in summary form beneath.
Here's an example:
http://tinyurl.com/yebcyg9
This works in a way but doesn't exclude the post currently being viewed in the list of articles below.
Can anyone help me achieve this - I guess i'll probably have to call something in my detail template.
Thanks
Russell
[SOLVED] Display related News articles excluding current article
-
homebrewruss
- Forum Members

- Posts: 12
- Joined: Wed Mar 04, 2009 3:18 pm
[SOLVED] Display related News articles excluding current article
Last edited by homebrewruss on Mon Sep 28, 2009 12:24 pm, edited 1 time in total.
-
homebrewruss
- Forum Members

- Posts: 12
- Joined: Wed Mar 04, 2009 3:18 pm
Re: Display related News articles excluding current article
..well that was easier than i initially thought - with a bit of help from print_r and smarty 
In the news summary template i was using to display related news articles i just grabbed the id of the news item i was displaying in detail and assigned it a new variable 'currentitem'.
Then after the foreach loop to display all items i just added an if statement to test the id of each entry in the $items array.
In the news summary template i was using to display related news articles i just grabbed the id of the news item i was displaying in detail and assigned it a new variable 'currentitem'.
Then after the foreach loop to display all items i just added an if statement to test the id of each entry in the $items array.
Code: Select all
{assign var='currentitem' value=$entry->id}
{foreach from=$items item=entry}
{if $entry->id !=$currentitem}
{* code to display each item in summary goes here *}
{/if}
{/foreach}Re: [SOLVED] Display related News articles excluding current article
AWESOME! thats is exactly what i was looking for! nice idea 
thank you very much
thank you very much
