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,230
  • Total Topics: 21,353
  • Online today: 446
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 405
  • Total: 405

Question about articles

Started by Bec, March 27, 2009, 02:06:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

willcom

Thanks Bec, that's cheating but I like your approach.  I was thinking that maybe you'd written some really clever code, I didn't even think about doing that.  I did find and modify some code if you want to automate your page, it will work with your tables if you splice it up.

Have a go and see what you think, you can specifiy which article it is in the call WHERE c.id IN ('1', '2') This one brings back all articles in cat 1 & 2 so you can put all your articles in one page and split them up on others like you have.  This goes in a php code block.

$max_shown=5;
$articles=db_query("SELECT a.id,a.subject,a.intro,a.author,a.authorid,a.date,c.value1 as category,a.category as category_id, IF(length(c.value4) > 0,c.value4,'/sorcey/tp-files/tp-articles/icons/TPadm-article.gif') as category_img FROM smf_tp_articles a inner join smf_tp_variables c on a.category = c.id WHERE c.id IN ('1', '2') AND approved=1 AND off=0 ORDER BY date DESC LIMIT " . $max_shown, __FILE__,__LINE__);
$cnt=0;

While ($row=mysql_fetch_row($articles))
{
    echo '<table cellspacing="0" cellpadding="0" width="100%" style="margin-top: 4px;
             margin-bottom: 4px;" border="0"><tr><td>';
    echo '
    <p><a href="index.php/cat,' . $row[7] . '.html"><img src="' . $row[8] . '" align="left" hspace="5"></a> <a href="index.php/page,' . $row[0] . '.html"><b><h3 style="margin-bottom:0px">' . $row[1] . '</h3></b></a>
<font style="margin-left:27px" size="1"><em>by <a href="index.php?action=profile;u=' . $row[4] . '"><b>' . $row[3] . '</b></a> on ' . date( "d/m/y", $row[5] ) . '</em></font></div>
<p>' . $row[2] . '  <strong><a href="index.php/page,' . $row[0] . '.html">read more...</a></strong></p>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }


This post should help you a little.  Not sure on how to show the image for the article but I beleive it's in there somewhere, I'll update if I find it.

http://www.tinyportal.net/index.php/topic,3320.0.html

Bec

No cheating :P I got the look the wanted, who cares how I got it lol

Thanks matey!

This website is proudly hosted on Crocweb Cloud Website Hosting.