Hi!
I have a site where I only use article blocks as frontpage blocks. But as I've found out, the sorting order of the articles within the blocks isn't alphabetically by subject NOR by publishing date...
So my question is: What is the publishing order of articles in article blocks? Is it by the primary keys in the SQL table or what?
Anyway, shouldn't that be changed to, at least, alphabetically by subject or by date?
be nice if it was by date.
It would also be nice if it would sort by date, and allow for the display of the article introduction text/image. This way, in a category display block, you could say show only the last 5 articles, with the most recent at the top, keeping a homepage/frontpage block constantly and automatically updated with your newest article content.
The article-box has been neglected to some point in these areas, and should yes, sort properly on critera. Preferably a adjustable one. I will address this better for TP 1.0.
In the meantime, you can change this easily. Open TPortal.php and find this code block:
if(isset($using_article) && $fetchart!=''){
$request = db_query("SELECT art.*, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchart
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER", __FILE__, __LINE__);
change to:
if(isset($using_article) && $fetchart!=''){
$request = db_query("SELECT art.*, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchart
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER ORDER BY art.date DESC", __FILE__, __LINE__);
Thats for sorting on date, newest first. For subject sorting use ORDER BY art.subject ASC.
*smacks head*
I totally forgot..this won't help much really, becasue its the blocks placement that decides what article comes first, as each articleblock specifies one particular article.
On that aspect it can't auto-sort, as the blocks use a position system.
Oh, sorry and oops Bloc :o!
I don't use article blocks but article cateogory blocks.... Then perhaps your solution will help, on the other hand :D?
ah, that explains it lol.
And yes, it does. To clear it up, here the code you need to look for in TPortal.php:
// any cat listings from blocks?
if(isset($using_catlisting) && $fetchtitles!=''){
$request = db_query("SELECT art.id, art.subject, art.category, art.authorID, art.shortname, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchtitles
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER", __FILE__, __LINE__);
and what to replace it with:
// any cat listings from blocks?
if(isset($using_catlisting) && $fetchtitles!=''){
$request = db_query("SELECT art.id, art.subject, art.category, art.authorID, art.shortname, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchtitles
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER ORDER BY art.date DESC", __FILE__, __LINE__);
Ah, many thanks :up: and sorry about any confusion :'(
wonderful. What about adding the intro text for the article in the category box?
We have that working on our homepage, using the recent articles code snippet stickied in your code forum. It would be great to have a tp category block do this as well, since it's easier to manage within the tp admin panel.
I'll see f that can be a choice for TP 1.0. Sort of enhanced listing.
I would also suggest, bloc, that you add user permissions to be able to view articles, like you do for blocks.
yep, that goes for me too... and I guess plenty of others as well >:D. But for now, I'm very pleased :).
Category permissions are already there in TP 1.0. I don't see a point in doing a per article permission.
Quote from: IchBinâ,,¢ on March 20, 2008, 10:27:50 PM
Category permissions are already there in TP 1.0. I don't see a point in doing a per article permission.
If I had 1.0, I wouldn't make the suggestion. But if it category permissions are in place, article permissions would be nice to have as well.