[pLog-general] question about getBlogArticles?

Jon Daley plogworld at daley.snurgle.org
Sat Feb 19 16:39:04 GMT 2005


 	Changing the default sounds good.

 	But, perhaps in_main_page should be removed also?  I guess it depends 
on (obviously) if is only supposed to return main page categories or not.  I 
would have expected it to be any category, but current callers might assume 
otherwise.

On Sat, 19 Feb 2005, linuxman wrote:

> or, change the default value of parameter categoryId to -1 in function
> getBlogArticles.
> 
>  2005-02-19 20:59 +0800linuxman
>> The question is actually about buildWhere, the codes list below:
>> 
>>             if( $categoryId == -1 )
>>                 $query .= " AND c.id = l.category_id AND a.id =
>> l.article_id ";
>>             else {
>>                 if( $categoryId > 0 )
>>                     $query .= " AND a.id = l.article_id AND
>> l.category_id = $categoryId AND c.id = l.category_id";
>>                 else {
>>                     $query .= " AND c.id = l.category_id AND a.id =
>> l.article_id AND c.in_main_page = 1";
>>                 }
>>             }
>> 
>> 
>> So, what if we call getBlogArticles by
>> $articles->getBlogArticles($blogId)? should return all articles blongs
>> to that $blogId? But the default parameter of categoryId is 0, is
>> buildWhere part will be :
>> 
>> $query .= " AND c.id = l.category_id AND a.id = l.article_id AND
>> c.in_main_page = 1";
>> 
>> You can see, will return all articles that showed in main page.
>> 
>> Any idea? remove AND c.in_main_page = 1 in buildWhere function?
>> 
>> Best regards,
>> 
>> Su Baochen



More information about the pLog-general mailing list