TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 142
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 105
  • Total: 105

Problem with Article Category Block

Started by insanemustang, April 24, 2007, 05:32:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

insanemustang

1 - I created a block for an article category.  The block lists my articles, but when I add a new article it puts it on the bottom instead of the top.  How can I fix this?

2 - I'm also wondering how can I add the time beside the Author's Name.  Right now it says "article title" by "author" and I would like to add "Date/Time" right beside that.

3 - How can I space the different entries a little bit more.  There right on top of each other right now, I'd like to add just a tad bit of spacing between them.

Thanks in advance, hope to God I put this in the right place so I don't knockIchbin off his perch.

rockon123

I too would like to know the answer to these questions.


rockon123

Can someone please post some helpful information?  People are posting help in every other topic but this one.

Nokonium

Quote from: rockon123 on April 29, 2007, 07:26:32 PM
People are posting help in every other topic but this one.

That is because we can answer those, but cannot answer your questions.

I have looked at the code for articles and I don't have the slightest idea how to do what you are asking.

rockon123

Thanks for your reply, first.  I am unaware with how to modify something like this also, but I figure someone here must know...surely it's not too difficult, I'm just TP stupid.

G6Cad

I can assure you that we have been reading your post, so no one have just skipped it.

And some of the coders here are really good with what they do, and if it was an easy task to give you what you want, they would have i believe.

So eather you have to wait for Bloc to help you (will take some time and patiense as he is very tied up in both work, family and another big project that needs his attention on avaliable time) or hope that some of the coders (J.A Cortina, JP Deni or Thurnok ) will find some time to try diffrent things out in order to get it to work.
Some times it's not just a small change of code as security must be the same level, and also other things in the forum or TP can get affected if you change a file or code somwhere as a lot of the files are working to gether and are used by several things at the same time.

So please, be patient and hope they have an answer for you, but nothing will be promissed.

rockon123

I understand, I just felt like the topic was getting overlooked and I needed a response just like the original author did.

Thanks for your help, I just assumed that this couldn't be that difficult since it is simply changing the order in which it was listed, not an actual major change.

But what do I know?

IchBin

Well I assure you its not just a simple thing. Although I consider myself a php novice, I was looking at the code for this. The date has to be added to the query in TPortal.php from what I can tell, and then you call it in the TPortalBlocks.template.php just for the date.
To add space I suppose another line break could be added. But that might be a bit too much spacing. If I get this working I'll post what I have.

IchBin

Ok, a bit easier than what I thought. :D This should add the date to the article and order the results by date also.

Open Themes/default/TPortalBlocks.template.php and fine the following line at (located a few lines up from the bottom). You can add another
 to this line to double space the links.

echo '<b><a href="'.$scripturl.'?page='.$listing['id'].'">'.$listing['subject'].'</a></b> '.$txt[525].' '.$listing['poster'].'<br />';


Replace with:
echo '<b><a href="'.$scripturl.'?page='.$listing['id'].'">'.$listing['subject'].'</a></b> '.$txt[525].' '.$listing['poster'].' on '.$listing['date'].'<br />';

Open Sources/TPortal.php and find: (approx. line 559)
    // 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__);
         $context['TPortal']['blockarticle_titles']=array();
if (mysql_num_rows($request) > 0)
{

while($row = mysql_fetch_assoc($request))
{
$context['TPortal']['blockarticle_titles'][$row['category']][] = array(
'id' => $row['id'],
'subject' => $row['subject'],
'shortname' => $row['shortname'],
'category' => $row['category'],
'poster' => '<a href="'.$scripturl.'?action=profile;u='.$row['authorID'].'">'.$row['realName'].'</a>',
);
}
mysql_free_result($request);
}
    }


Replace with:

    // any cat listings from blocks?
    if(isset($using_catlisting) && $fetchtitles!=''){
$request = db_query("SELECT art.id, art.date, 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__);
         $context['TPortal']['blockarticle_titles']=array();
if (mysql_num_rows($request) > 0)
{

while($row = mysql_fetch_assoc($request))
{
$context['TPortal']['blockarticle_titles'][$row['category']][] = array(
'id' => $row['id'],
'date' => date('j/n/Y', $row['date']),
'subject' => $row['subject'],
'shortname' => $row['shortname'],
'category' => $row['category'],
'poster' => '<a href="'.$scripturl.'?action=profile;u='.$row['authorID'].'">'.$row['realName'].'</a>',
);
}
mysql_free_result($request);
}
    }


If you want the date format changed let me know what format you would like and I'll change it.

This website is proudly hosted on Crocweb Cloud Website Hosting.