TinyPortal

Development => Support => Topic started by: insanemustang on April 24, 2007, 05:32:33 PM

Title: Problem with Article Category Block
Post by: insanemustang on April 24, 2007, 05:32:33 PM
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.
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 25, 2007, 07:36:59 PM
I too would like to know the answer to these questions.
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 26, 2007, 06:43:12 PM
anyone?
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 29, 2007, 07:26:32 PM
Can someone please post some helpful information?  People are posting help in every other topic but this one.
Title: Re: Problem with Article Category Block
Post by: Nokonium on April 29, 2007, 07:46:10 PM
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.
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 29, 2007, 08:06:13 PM
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.
Title: Re: Problem with Article Category Block
Post by: G6Cad on April 29, 2007, 09:38:46 PM
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.
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 29, 2007, 09:46:08 PM
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?
Title: Re: Problem with Article Category Block
Post by: IchBin on April 30, 2007, 03:30:41 AM
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.
Title: Re: Problem with Article Category Block
Post by: IchBin on April 30, 2007, 03:47:39 AM
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.
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 30, 2007, 04:17:49 AM
Hey Ich, thanks alot for your help, I really appreciate it.  I wanted the format of the date changed, but figured since you had already helped me out, I would figure out how to do it myself and I did.  So now the date displays more to my liking.  Thanks again for your help.

I see what the original author meant about the spacing. How might I go about trying that, if I wanted to space out each entry, just by a pixel or two how would I do that?  Could I try an invisible table for each entry?
Title: Re: Problem with Article Category Block
Post by: IchBin on April 30, 2007, 04:25:37 AM
You would probably have to take the first line of code I posted and add some CSS to it.

Perhaps something like this.
echo '<div style="padding-bottom: 5px"><b><a href="'.$scripturl.'?page='.$listing['id'].'">'.$listing['subject'].'</a></b> '.$txt[525].' '.$listing['poster'].' on '.$listing['date'].'<br /></div>';

You can change 5px to whatever you desire. :)
Title: Re: Problem with Article Category Block
Post by: rockon123 on April 30, 2007, 04:33:06 AM
Worked like a charm, thanks a bunch Ich.....

Oh...and, I am sorry for the rude words I had for you....
Title: Re: Problem with Article Category Block
Post by: IchBin on April 30, 2007, 05:31:42 AM
Quote from: rockon123 on April 30, 2007, 04:33:06 AM
Worked like a charm, thanks a bunch Ich.....

Oh...and, I am sorry for the rude words I had for you....
TBH, I don't recall you having any rude words for me. Glad I could help though. :)
Title: Re: Problem with Article Category Block
Post by: rtr2006 on May 01, 2007, 07:11:17 PM
Hey, I found this article very helpful.  Ich, if I wanted to also add the number and comments beside this, what changes would need to be made?  Thanks in advance, this is a great add.
Title: Re: Problem with Article Category Block
Post by: rtr2006 on May 02, 2007, 09:38:09 PM
Ich do you know?
Title: Re: Problem with Article Category Block
Post by: IchBin on May 02, 2007, 10:58:36 PM
I don't know how the comments system works. Right now I just don't have the time to look any further into it. If someone doesn't help you then just bump this topic in about a week or so. I'm really busy right now.
Title: Re: Problem with Article Category Block
Post by: insanemustang on May 08, 2007, 08:39:54 PM
Waited 6 days as patiently as possible, so ... bump!!!  I'm also willing to paypal you some money to set me up with this request.

What I have: Right now the article title displays, and below it reads: by [name] on [date]

I want it to say: by [name] on [date] - [#ofviews] [#of comments]

Ich, let me know what you need to make this happen.

You can see it for yourself at http://www.BamaNation.net if this helps
Title: Re: Problem with Article Category Block
Post by: G6Cad on May 08, 2007, 10:52:08 PM
One way could be to just cgange the language strings for what you want them to say instead of what the say now.

Try and laborate some in the Tportal.english.php in themes/default/languages/

Title: Re: Problem with Article Category Block
Post by: insanemustang on May 09, 2007, 12:22:21 AM
Quote from: G6â„¢ on May 08, 2007, 10:52:08 PM
One way could be to just cgange the language strings for what you want them to say instead of what the say now.

Try and laborate some in the Tportal.english.php in themes/default/languages/



I will um, try?  I don't know what you mean but I will try lol
Title: Re: Problem with Article Category Block
Post by: insanemustang on May 09, 2007, 12:46:31 AM
I can't figure out if it's .listing, .item or if it [tp-comments] or [comments] if someone could help me there I would appreciate it
Title: Re: Problem with Article Category Block
Post by: insanemustang on May 10, 2007, 03:28:02 AM
Anyone?
Title: Re: Problem with Article Category Block
Post by: rebelrose on May 10, 2007, 04:50:48 AM
I am trying to see the problem but its not clear to me.
Title: Re: Problem with Article Category Block
Post by: insanemustang on May 10, 2007, 07:13:58 PM
Ok, we devised a system to where my articles post in a block in this format.

[article title] by [author] on [date]

I would like it to display like this
[article title] by [author] on [date] - [#ofviews] [#ofcomments]


Thanks Rebel Rose for replying.