By clicking on the author name, the visitor will be redirected to the news page listing only the articles created by the selected author.Sometimes, a forum question motivates me to work something out simply because i find it a great idea!
In the News summary template, replace the the second "foreach" opening statement:
{foreach from=$items item=entry}{foreach from=$items item=entry}
{if $smarty.get.selectedauthor!= ""}{capture assign="selectedauthor"}{$smarty.get.selectedauthor}{/capture}{/if}
{if $selectedauthor}{capture assign="newsauthor"}{$entry->author}{/capture}{/if}
{capture assign="newsitem"} Then replace the author:
{$entry->author}<a href="{$root_url}nieuwstest?selectedauthor={$entry->author}">{$entry->author}</a><a href="{$root_url}index.php?page=nieuwstest&selectedauthor={$entry->author}">{$entry->author}</a> Finally, replace the closing statement of that same "foreach":
{/foreach}{/capture}
{if $selectedauthor}
{if $newsauthor === $selectedauthor}{$newsitem}{/if}
{else}
{$newsitem}
{/if}
{/foreach} You can use various techniques to hide the news sidebar (if you are using one) when the newspage is being shown. Just enter your preferred smarty code in your template to avoid showing the news items twice on the same page... You can find more information on this by searching the cmsms forum.
Greetings,
Manuel
Hi, thanks you for this tip. I' trying to make it work with CGBlog but I only get the "Author" custom field to link with the "news" page which is empty. Thanks you for your help.
Hi, Thanks for this very useful. Only problem is that its not working as intended. When I click on my name, it takes me back to the home page.
I used "news" as the news page alias.
ps: does anyone know if i should use the escape:'htmlall' modifier on $smarty.get.selectedauthor for security reasons or is this redundant?
Greetings, Manuel