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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,242
  • Total Topics: 21,353
  • Online today: 192
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 415
  • Total: 416
  • lurkalot

Article order - cannot change

Started by Doma, July 24, 2009, 06:23:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Doma

Here is my setup:

SMF 1.1.9
TinyPortal v1.0 beta 4

What I have is most assuredly a simple fix but after some time fiddling with it I cannot get it to work correctly. I am posting news articles in an Article block in the upper block section. When I post them they do show up, however the articles are all out of order. Like this:

Article #4 written at 8:00am
Article #2 written at 5:00am
Article #3 written at 7:45 am
Article #1 written at 4:00am
Article #5 written at 10:00am

Some of the articles are external, but the posting date and time are mine as set in the articles tab.

I have tried to force it by labeling each article with a number from 1-5 and seeing if I can get it to sort by the correct order. I also have deleted them all and reposted them. I have tried ordering it by ascending or decending, in 2 of the places I am able to sort this.

Any tips or help would rock.


Doma

Anyone have any ideas? I just posted 2 articles today and one is at the top of the list and the other is in the middle.

Freddy

Sorry no ideas.  I experimented on my test board and could not find any settings to specify what order the articles should be placed in.  They seem to be listed randomly for me too.  I guess this could be a kind of bug or perhaps needs some more thought.

Are all your articles in the same category ?  Just wondering because I might have some code you could use that I used to use on a site I have.

ZarPrime

I'm not sure if this may be a bug in TP 1.0 beta 4 or not.  I know I had someone go into phhpadmin one time and reorder their articles manually but that would be a pain if you had very many articles.

I will bring this to Bloc's attention on the Team board and see if he has any thoughts on it.  It may take a few days for him to respond because I know he's been on here most of the day today but I'll see if we can get some answers.  Like I said, it may take me a while to get his attention on this, so give me at least 3 or 4 days.

ZarPrime

Freddy

In the meantime, you could try out my code I dug out.  I think I must have found the same problem at some point and just wrote my own block code.  Here it is - just use it in a block where you like and alter the $category variable to suit.

global $scripturl, $db_prefix;

// Set your category here..
$category = 3;

$request = db_query("SELECT subject, id FROM {$db_prefix}tp_articles WHERE category LIKE '$category' ORDER BY date DESC", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request))
{
     echo '<span><strong><a href="' , $scripturl, '?page=' , $row['id'] , '">' , $row['subject'] , '</a></strong></span><br />';
}

mysql_free_result($request);

Doma

Freddy you are the bomb!

That did it thank you :)

You've helped me out like 2x in the last week with some very useful stuff. I appreciate the timely help!

ZarPrime

freddy,

Seem like I just gave you a thumbs up in another topic. ;D  Here's a couple more. :up: :up:

I've already posted this for Bloc's attention, so he'll probalby take a look at the problem when he can but I guess the urgency isn't there right now.  Freddy, have you posted that code in the Block code snippets board with an explanation yet?  That'd be a good one.

ZarPrime

Freddy

#8
 ;D yeah I am on a roll today I think and I am glad I could help Falconer.

Yes, I can add it to snippets if you want, sure, no problem.  First I need to fill my belly though, will drop by again later.

BFN.

Thanks for the thumbs up!!

Freddy

#9
Ok that's done - I added a couple of modifications too so it's more useful generally:

Link to Block...

This website is proudly hosted on Crocweb Cloud Website Hosting.