Hi
I m trying to run a filter to show More articles by an Author. If he has more articles, it will show the list OR not? But, I can’t properly figure out the condition, can you Pls, check and guide me?
Followings are the code that I m using:-
<? $author = str_replace("'", "\'", "{author_name}"); ?>
<? $url_t = str_replace("'", "\'", "{url_title}"); ?>
<? $cc=0; ?>
{exp:query sql="SELECT w.blog_name, t.title, t.url_title, t.entry_date, t.entry_id, d.field_id_12, d.entry_id, d.field_id_85
FROM exp_weblogs AS w, exp_weblog_titles AS t, exp_weblog_data AS d
WHERE w.weblog_id = t.weblog_id
AND t.entry_id = d.entry_id
AND t.entry_date < UNIX_TIMESTAMP( )
AND d.field_id_12 = '<? echo $author; ?>'
AND t.url_title!='<? echo $url_t; ?>'
AND (t.status != 'closed' AND t.status != 'editing')
AND (
w.weblog_id =4
OR w.weblog_id =5
OR w.weblog_id =7
)
ORDER BY t.entry_date DESC"}
{count}
{if count}
<?php $cc=2; ?>
{if:else}
<?php $cc=4; ?>
{/if}
{/exp:query}
<? echo $cc; ?>
<?php if($cc==2) { ?>
Want to read more articles by {author_name}? Click on the links below
<div class="section2">
<ul>
{embed=articles/more_by_author_query author="<? echo $author; ?>" url="<? echo $url_t; ?>"}
</ul>
</div>
<?php } ?>[Mod Edit: Moved to the Development and Programming forum]
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.