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: 1
  • Guests: 483
  • Total: 484
  • @rjen

Recent Articles For Center Block

Started by opschf, March 13, 2006, 03:48:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rabain

Am I just imagining things or was there an Articles link on the left panel when I installed TP?  I recall doing something to deactivate it but now I can't recall what it was and I want Articles back...it showed the two articles that come with TP (Portal Features category).  The link was in the same box as Download link and similarly had an icon beside it.

Anyway my main question was...I'm am currently using the code in the first post to display recent articles.  However I want to remove the line separating each article in the list and change the font size.  Where do I put this in the code, after the border/class part?

Zetan

1. Try adding an Article category block.

2. Don't know. At work and can't check.

IchBin

Try changing the class or taking it off. Trouble shoot it that way and you'll learn how it works.

Rabain

I'm currently using the following:

$articles=db_query("SELECT id,subject FROM smf_tp_articles WHERE approved=1 AND off=0 ORDER BY date DESC", __FILE__, __LINE__);
$cnt=0;
While ($row=mysql_fetch_row($articles)) {
   // The number of articles you want displayed
   if ($cnt < 5) {
          echo '<font size="1"><strong><a href="http://www.borderkingdoms.net/index.php?page=' . $row[0] . '">' . $row[1] . '</a><br />';
    }
   $cnt++;
}
If  ($cnt=0) {
echo '<td>No Artcles to review.  Please submit articles.';
}


My font size and is applying itself to every block in the panel rather than just this php block.

I've tried every form of </font> entry but I'm just not up to speed on html/php.

All I want is the text in the block to be size 1 and bold (which I just couldn't get to work so I'm going with !).

Any help is much appreciated
.

Zetan

You probably have an open font tag.. you need to close any open tags, else they will bleed into other areas.

eg



<font><strong> content.. you must now close the tags that are open </strong></font>


G6Cad

echo '<td>No Artcles to review.  Please submit articles.';

You have the <td> but not a closing < /td> in that line

Rabain

Thanks guys.  Seems to be working now!

Chipicao

Quote from: IchBinâ,,¢ on January 06, 2007, 06:21:57 AM
This for a php block. I just hashed out the code with some of the SMF guru's if this doesn't work out for you. Here's the code Jay, Daniel, and I came up with.


global $db_prefix, $scripturl;

$articles = db_query("
        SELECT art.date, art.author, art.subject, art.id, var.value1 AS category_name
        FROM {$db_prefix}tp_articles AS art
                LEFT JOIN {$db_prefix}tp_variables AS var ON (var.id = art.category)
        LIMIT 5", __FILE__,__LINE__);

echo '
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top: 4px; margin-bottom: 4px;" border="0" class="tborder">';

if (mysql_fetch_assoc($articles) == 0)
        echo '
<tr>
<td>No Reviews Available</td>
</tr>';
else
{
        while ($row = mysql_fetch_assoc($articles))
                echo '
<tr>
<td>
<a href="', $scripturl ,'?page=', $row['id'], '"><b>', $row['subject'], '</b></a>
<div style="padding: 8px; padding-top: 0px;">
By : <b>', $row['author'], '</b><br />
Created on: ', date("m/d/y", $row['date']), '<br />
Category: ', $row['category_name'], '
</div>
</td>
</tr>';


}
echo '
</table>';

mysql_free_result($articles);

How can I sort the articles by date, and how can I make it show only articles from one of the categories?

IchBin

Don't know if this will work as I haven't tested it. But give this a shot just changing this section of code: (don't forget to replace the category name where I put 'put_category_name_here').
$articles = db_query("
        SELECT art.date, art.author, art.subject, art.id, var.value1 AS category_name
        FROM {$db_prefix}tp_articles AS art
        ` LEFT JOIN {$db_prefix}tp_variables AS var ON (var.id = art.category)
WHERE category_name = 'put_category_name_here'
ORDER BY art.date
        LIMIT 5", __FILE__,__LINE__);


Chipicao

#39
Thank you for the quick reply.

The category filter doesn't work. I get this error:
QuoteDatabase Error: Unknown column 'category_name' in 'where clause'
File: /var/www/sites/dev.sayit.ro/Sources/Load.php(1749) : eval()'d code(35) : eval()'d code
Line: 9

The sorting works, but it's ascending, so I have to use this:
ORDER BY art.date DESC

Any ideas? What exactly should I put instead of put_category_name_here? The actual name of the category?

This website is proudly hosted on Crocweb Cloud Website Hosting.