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,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 513
  • Total: 513

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.

ZarPrime

willcom,

This is kind of an old topic so it might help our coders, when they see this, if you could rephrase your question.  What little icon and what article image are you talking about?  If this code is from one of the blocks of code in this topic, it might help them if you could post the whole code you are using.

ZarPrime

Freddy

Yeah, I can see what to do here, but need to see which version of the code you are using.  But that said I should be able to help.  Cheers.

willcom

My mistake sorry folks.  Here is the code I'm using, it has a small icon next to <h3> and was wanting to know how to replace this with the article image (I guess that's the icon for the article category?)

See it in action on www.sorcey.co.uk


$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><strong><a href="index.php?page=articles">More articles...</a></strong>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }


And why does the WYSIWYG editor sometimes flicker up and down when I'm trying to type!!!   :tickedoff:

Freddy

#103
I think you can just change the line starting with $articles...

Change :

/sorcey/tp-files/tp-articles/icons/TPadm-article.gif

To wherever your alternative image is :

/path/to/my/image.gif

Is that what you mean - or do you mean a different image for each article ?

This website is proudly hosted on Crocweb Cloud Website Hosting.