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: 1
  • Guests: 566
  • Total: 567
  • @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.

alhaudhie

Quote from: bigdog on March 28, 2008, 04:55:56 AM
here's our final version, pretty much.

shows image category icon, article title in a larger font, and bolded, the author, with their name linked to their profile, and the date of posting.  Also shows the article introduction.

$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,'http://www.texasteamplayers.com/misc/images/newspaper.png') as category_img FROM smf_tp_articles a inner join smf_tp_variables c on a.category = c.id WHERE 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="http://www.texasteamplayers.com/index.php?cat=' . $row[7] . '"><img src="' . $row[8] . '" align="left" hspace="5"></a> <a href="http://www.texasteamplayers.com/index.php?page=' . $row[0] . '"><b><font size="4">' . $row[1] . '</font></b></a> <font size="1"><em>by <a href="http://www.texasteamplayers.com/index.php?action=profile;u=' . $row[4] . '"><b>' . $row[3] . '</b></a> on ' . date( "m/d/y", $row[5] ) . '</em></font></div>
<font size="1">' . $row[2] . '</font>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }


see it in action as the first center block on www.texasteamplayers.com homepage.

when user click the article topic... its automatically bring user to log off but still can read article but not to post comment because there are now guest.

alhaudhie

Quote from: alhaudhie on April 17, 2008, 05:22:14 AM
Quote from: bigdog on March 28, 2008, 04:55:56 AM
here's our final version, pretty much.

shows image category icon, article title in a larger font, and bolded, the author, with their name linked to their profile, and the date of posting.  Also shows the article introduction.

$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,'http://www.texasteamplayers.com/misc/images/newspaper.png') as category_img FROM smf_tp_articles a inner join smf_tp_variables c on a.category = c.id WHERE 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="http://www.texasteamplayers.com/index.php?cat=' . $row[7] . '"><img src="' . $row[8] . '" align="left" hspace="5"></a> <a href="http://www.texasteamplayers.com/index.php?page=' . $row[0] . '"><b><font size="4">' . $row[1] . '</font></b></a> <font size="1"><em>by <a href="http://www.texasteamplayers.com/index.php?action=profile;u=' . $row[4] . '"><b>' . $row[3] . '</b></a> on ' . date( "m/d/y", $row[5] ) . '</em></font></div>
<font size="1">' . $row[2] . '</font>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }


see it in action as the first center block on www.texasteamplayers.com homepage.

when user click the article topic... its automatically bring user to log off but still can read article but not to post comment because there are now guest.

anybody can reply this?

JPDeni

Is your site http://www.texasteamplayers.com/ ? Is the code in your post the actual code that you are using?

alhaudhie

thats not my site...

but i have change all the link to my site link...

JPDeni

I can't debug your code unless you post your code.

alhaudhie

this my code....

$max_shown=3;
$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,'http://www.mysite.net/v10/imej/umum.png') as category_img FROM smf_tp_articles a inner join smf_tp_variables c on a.category = c.id WHERE 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="http://www.mysite.net/v10/index.php?cat=' . $row[7] . '"><img src="' . $row[8] . '" align="left" hspace="5"></a> <a href="http://www.mysite.net/v10/index.php?page=' . $row[0] . '"><b><font size="2px">' . $row[1] . '</font></b></a> <font size="1"><em>by <a href="http://www.mysite.net/v10/index.php?action=profile;u=' . $row[4] . '"><b>' . $row[3] . '</b></a> on ' . date( "m/d/y", $row[5] ) . '</em></font></div>
<font size="1">' . $row[2] . '</font>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
If  ($cnt=0) {
    echo '<td>No Articles Available';
    }

JPDeni

I rearranged it a bit to make it easier for me to read. I'm not sure if this will solve your problem, but it should work.


global $scripturl;

$max_shown=3;
$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,
            'http://www.mysite.net/v10/imej/umum.png') as category_img
            FROM smf_tp_articles a inner join smf_tp_variables c
            ON a.category = c.id
            WHERE 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="' . $scripturl . '?cat=' . $row[7] . '">
       <img src="' . $row[8] . '" align="left" hspace="5"></a>
       <a href="' . $scripturl . '?page=' . $row[0] . '">
       <b><font size="2px">' . $row[1] . '</font></b></a>
       <font size="1"><em>by <a href="' . $scripturl . '?action=profile;u=' . $row[4] . '">
       <b>' . $row[3] . '</b></a> on ' . date( "m/d/y", $row[5] ) . '</em></font></div>
       <font size="1">' . $row[2] . '</font>
     </p></td>';
     echo '</tr></table>';
   $cnt++;
}
if  ($cnt=0) {
    echo 'No Articles Available';
}



alhaudhie

 :up: :up:

thanks soo much...

really nice...

alhaudhie

#78
how can i make the space between 2 article soo closed?


JPDeni

Quotehow can i make the space between 2 article soo closed?
I don't understand. Do you want them closer together or further apart?

This website is proudly hosted on Crocweb Cloud Website Hosting.