Hello,
It’s my first post here and I am new to EE, but developing my forst website with it is going quite well. But now I am a little bit stuck on small issue.
I have a “news” channel with multiple categories. On “news/index” page I want to display 4 latest news (NO MATTER THE CATEGORY) in a form of banner and after that I want to display a box for each category with latest news from that category.
I have accomplished all of that using:
{exp:channel:entries channel="news" limit="4" sort="desc"}
{/exp:channel:entries}for the banner.
And:
{exp:channel:categories channel="news" style="linear"}
{exp:channel:entries channel="news" limit="2" sort="desc" category="{category_id}"}
{/exp:channel:entries}
{/exp:channel:categories}to display news from each category.
The only problem that I have is this. If I have a post displayed in main banner (with 4 latest news) I don’t want to display it in categories box. I can use code like:
{exp:channel:entries channel="news" limit="2" sort="desc" category="{category_id}" entry_id="not <entry_banner_id_1>|<entry_banner_id_2>|<entry_banner_id_3>|<entry_banner_id_4>"}But I do not know how to save entries that I have used in the first {exp:channel:entries} and use is as entry_id parameter in second {exp:channel:entries}.
Here is my code:
<?php $usedEntries = array(); ?>
{exp:channel:entries channel="news" limit="4" sort="desc"}
<?php $usedEntries[] = "{entry_id}"; ?>
{/exp:channel:entries}
<?php $usedEntries = implode('|', $usedEntries); ?>
{exp:channel:categories channel="news" style="linear"}
{exp:channel:entries channel="news" limit="2" sort="desc" category="{category_id}" entry_id="not <?php echo $usedEntries; ?>"}
{/exp:channel:entries}
{/exp:channel:categories}But this does not work because of order in which php and ee tags are processed.
Does anyone have any suggestions how I can solve this.
Thanks in Advance