Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

November 30, 2022, 12:25:13 AM

Login with username, password and session length
Members
  • Total Members: 3853
  • Latest: tty456
Stats
  • Total Posts: 193625
  • Total Topics: 21107
  • Online today: 43
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 0
Guests: 33
Total: 33

Author Topic: Recent Articles For Center Block  (Read 44825 times)

0 Members and 1 Guest are viewing this topic.

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: Recent Articles For Center Block
« Reply #100 on: August 04, 2009, 04:30:23 AM »
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

Offline Freddy

  • Moderator
  • *
  • Posts: 1617
    • AiDreams
Re: Recent Articles For Center Block
« Reply #101 on: August 04, 2009, 05:44:19 AM »
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

  • Guest
Re: Recent Articles For Center Block
« Reply #102 on: August 04, 2009, 07:17:53 AM »
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

Code: [Select]
$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:

Offline Freddy

  • Moderator
  • *
  • Posts: 1617
    • AiDreams
Re: Recent Articles For Center Block
« Reply #103 on: August 04, 2009, 09:40:08 AM »
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 ?
« Last Edit: August 04, 2009, 10:17:28 AM by freddy888 »