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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 331
  • Total: 331

Article Page Numbers question

Started by DonaldDasher, September 15, 2008, 06:33:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ianedres

With full credit to JPDeni... I modified that code to link using the query title; if not set, it will use the page id.

global $db_prefix, $scripturl, $user_info;

$query = db_query(
    "SELECT subject, id, date, shortname
     FROM {$db_prefix}tp_articles
     WHERE approved = 1
     ORDER BY date DESC
     LIMIT 10", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if(empty($row['shortname'])) $row['shortname'] = $row['id'];

  echo '<a href="' . $scripturl . '?page=' . $row['shortname'] . '">' . $row['subject'] . '</a> ' . timeformat($row['date'], $user_info['time_format']) . '<br />';
}

DonaldDasher


Ianedres

Trying to earn my badge here on TP...  ;)

Glad you're liking TP. You should be able to see the power and flexibility that it has already, plus, I like to think, a great support staff too.

Again, good luck with TP.

DonaldDasher

I was saying just now to the guy I run my site with what excellent and super fast support you guys offer. :)

Ianedres

Well, there are times when replies don't come so fast, as we all volunteer our time and have real-life factors to account for...

But thanks for letting others know about TP and the support you've received.  :D

DonaldDasher

My pleasure. I've learned a lot in the few weeks I've been posting here.

JPDeni

Oops. I guess I didn't read the second page. I changed the code over in the original topic.

This website is proudly hosted on Crocweb Cloud Website Hosting.