TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 06:59:23 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 164
  • Total: 164

Recent topics and articles, question

Started by dimdom, January 10, 2009, 04:54:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dimdom

I would like to combine these two codes:

// "Recent Topics" a php Block
// Prefered settings when being designed
// Border and title on
// Title ="Recent Topics"

global $scripturl;
$what=ssi_recentTopics('5', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Subject </td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0"

/></a>';
     '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>';


and

// Multi Function Article Snippet
// By Dragooon
// www.gforumx.com
// Version 1.1

// Declare the globals to call the main file
global $sourcedir;

// And Call the file
require_once($sourcedir . '/ArticleSnippet.php');

// Declare it, No Need to edit this!
$cats = array();

/************************************
* About
************************************/
# Here is the way You can use it. Please keep reading this before using this snippet so that you will be able to take the full advantage of this snippet.
# There is a set of variables used later(In the function part) which are used to customize. Here is how to use them. Do Not edit the variables in this

About, as it will Simply wont work :P

# $mode : This Controls the Mode. You can set it 1,2,3,4,5 or 6. Here is what each mode refers to.
# 1 : Recent Article Posted
# 2 : Top Commented
# 3 : Top Viewed
# 4 : Top rated
# 5 : Recent Comments
# 6 : Random Articles

# $limit : This controls the maximum no. of articles(Or comments if you have mode as 5) to show

# $cats : This is a array which can be specified to show articles(Or Comments if you have mode set to 5) from specific category or multiple

categories. Leave blank to show from all categories or use 0 for the uncategorized ones, And use comma ( , ) as a separator. You have to enter the

Category's ID not Name

# Now I'll be telling the 7 variables used for showing/not showing some stats/attributes of the article(Or Comment). Set to true if you want to show and

false if don't

# $show_comments : Weather to show the no. of comments or not(Doesn't works if Mode is the 5th one).

# $show_views : Weather to show the no. of views or not(Doesn't works if Mode is the 5th one).

# $show_rating : Weather to show the rating of article and no. of voters or not(Doesn't works if Mode is the 5th one).

# $show_time : Weather to show the time the article/comment was posted on or not.

# $show_category : Weather to show the category it was posted in or not(Doesn't works if Mode is the 5th one).

# $show_author : Weather to show the articles/comments' author or not.

# $show_articleComment : Weather to show the article the comment was posted in(Only applies of Mode is the 5th one)

# $output_method : This is a tricky variable which I just included for the ones who have even Basic PHP/HTML Knowledge to customize the whole

thing according to there wish. If Set as "array", this will stop showing anything but will return the variables but if set as "echo" it will show the default

layout(Which is made mainly for using it in a Block). # If you are using the array method All the $show_ variable will get useless(you can use the

variables returned to customize then ;) ). See the File to know what all the variables are.
# If you are using this, Make sure to set something like $item = *The rest of the function*, not just function and use a foreach loop later.
# This is the same way the SSI's $output_method behaves so if you are confused on how to use it, use it like the SSI's variable are used.
# If you don't know coding or don't want to change its looks, I recommend using it as the default "echo" method as IMO it is the best.

// This was the whole *How to* type of part. If you have questions/comments please use the Snippets Topic(From where you got it).
/************************************
* End About
************************************/

/************************************
* The Main Function
************************************/
articles(
$mode = 1,
$limit = 5,
$cats = array(60,1,50,167),
$show_comments = true,
$show_views = true,
$show_rating = false,
$show_time = false,
$show_category = true,
$show_author = false,
$show_articleComment = true,
$output_method = 'echo'
);
/************************************
* And here it ends
************************************/

// Thank you for using this snippet :).


to have ONE block like in first page of http://www.dzinerstudio.com/, or similar to that (see picture).

Thank you!

dimdom

My problem is that I dont know how to show these two tables one next to the other since I am not a php-html guru... :o

G6Cad

Please dont bump your post, edit the one you have instead.

IchBin

The php you need to know is minimal to make this work. You just need to know how to position HTML more than how to echo out HTML


echo '
<table>
   <tr>
       <td>';
first code snippet here
echo '
       </td>
       <td>';
second code snippet here
echo '
       </td>
   </tr>
</table>';


That should show them each in their own column. You can then style the table to look however you would like. If you're using TP 1.x you also have other options for showing blocks side by side as well.

dimdom


dimdom

#5
QuoteIf you're using TP 1.x you also have other options for showing blocks side by side as well.

No, I use the 0.9.8, so I have to mess with the codes. :)



Well, I managed so far to have this (see picture) using the below code...

It shows newest topics/answers to the left and newest articles to the right.

But I can not find a way to add a title in the second table which contains the newest articles...

The code is:

echo '
<table>
    <tr>
        <td>';

global $scripturl;
$what=ssi_recentTopics('5', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Θέμα </td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0"

/></a>';
     
'</span></td></tr>';
  }

echo '</table>';

echo '
        </td>
        <td>';
 
  function articles($mode, $limit, $cats, $show_comments, $show_views, $show_rating, $show_time, $show_category, $show_author, $show_articleComment, $output_method) {

// Da Globals!! :P
global $db_prefix, $settings, $scripturl;

// Get the $tp_prefix ready
$tp_prefix = $settings['tp_prefix'];

// The Category time!
$cat = '';
    $categories = implode(', ', $cats);
if(!empty($cats))
  $cat = "AND a.category IN ($categories)";

// Do all this stuff if Mode is not the 5th one!
// I Believe this will optimize stuff. Well Atleast there is some cutting down in these queries
if($mode != 5)
{
$subcheck = '';
// Get the mode(1-4) parameters ready
if($mode == 1)
{
$m = 'a.date DESC';
}
elseif($mode == 2)
{
$m = 'a.comments DESC';
$subcheck = 'AND a.comments > 0';
}
elseif($mode == 3)
{
$m = 'a.views DESC';
$subcheck = 'AND a.views > 0';
}
elseif($mode == 4)
{
$m = 'a.rating DESC';
}
elseif($mode == 6)
{
$m = 'RAND()';
}
else
$m = 'a.date DESC';

// Well this was the mode and parameters, begin the Queries.
  $result = db_query("SELECT
a.id AS atcID, a.date, a.category, a.subject, a.voters,
a.authorID, a.approved, a.off, a.comments, a.views, a.rating, a.useintro,
                    v.id AS catID, v.value1, v.value2, value3, v.value4, v.value5,
                    m.realName
                    FROM
                    {$tp_prefix}articles AS a
                    LEFT JOIN {$db_prefix}members AS m ON (m.ID_MEMBER = a.authorID)
LEFT JOIN {$tp_prefix}variables AS v ON (v.id = a.category)
                    WHERE
                    a.approved = 1
                    AND a.off = 0
                    $cat
$subcheck
                    ORDER BY $m
                    LIMIT $limit"
                    ,__FILE__, __LINE__);

// Do da error saving declaration! :P
$items = array();

// And do the next step :D
while ($row = mysql_fetch_assoc($result))
{
// Lets calculate the rating stuff
$rat = array();
$votes = 0;
$total = 0;
$average = 0;
$rat = explode(",", $row['rating']);

$votes = count($rat);

foreach($rat as $mm => $mval)
$total = $total + $mval;

if($votes > 0 && $total > 0)
$average = floor($total / $votes);

// And now lets build up the array
   
$items[] = array(
    'article' => array(
      'id' => $row['atcID'], # Article ID
      'time' => timeformat($row['date']), # Time the article is posted on
      'subject' => $row['subject'], # Article's Subject
      'artLink' => '<a href="'.$scripturl.'?page='.$row['atcID'].'">'.$row['subject'].'</a>', # Direct link to article
      'comments' => $row['comments'], # No. Of article's comments
      'views' => $row['views'], # No. Of article's views
      'rating' => $average, # Total Article's rating
      'voters' => $votes, # No. of total votes
      'is_rated' => !empty($row['rating']), # Is it rated?
      'is_categorized' => $row['category'] != 0, # Does it have a category?
    ),
    'author' => array(
    'id' => $row['authorID'], # Author ID
      'name' => $row['realName'], # Author Name
      'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['authorID'].'">'.$row['realName'].'</a>', # Direct link to author
      ),
    'cat' => array(
      'id' => $row['catID'], # Cat ID
          'name' => $row['value1'], # Cat Name
          'link' => '<a href="'.$scripturl.'?cat='.$row['catID'].'">'.$row['value1'].'</a>', # Direct link to category
    ),
    );
}

// Free $result from the evil querys as usual :P
mysql_free_result($result);

// Output method is selected as "array"? Throw the variables back to them
if($output_method == 'array')
return $items;

// Not "array"? Throw the default output out.
$counter = 0;
echo '<span class="normaltext">';
foreach ($items as $i)
{
$counter++;
echo '<div>',$i['article']['artLink'],'</div>';
echo '<div>';

// Show the no. of comments?
if($show_comments)
    echo 'Σχόλια: ',$i['article']['comments'],'  ';

// Show the no. of views?
if($show_views)
  echo 'ΕμφανίσειÏ,: ',$i['article']['views'],' ';

// Show there ratings?
if($show_rating)
{
// Is it rated?
    if($i['article']['is_rated'])
    {
        echo '<br />Rating: ',str_repeat('<img src="'.$settings['images_url'].'/tpblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $i['article']['rating']),' (',$i['article']['voters'],' Votes)';
        }
// No?
        else
        {
        echo '<br />Î'αθμολογία: <i>ΧωρίÏ, βαθμολογία</i> (0 Voters)';
        }
    }

// Show its category?
            if($show_category && $i['article']['is_categorized'])
            echo '<br />ΣÏ,,ήν καÏ,,ηγορία ',$i['cat']['link'],'.';

// Show the author?
            if($show_author)
            echo '<br />Î'πό ',$i['author']['link'];

            // Show the time its posted on
if($show_time)
            echo '<br />ΣÏ,,ίÏ, ',$i['article']['time'];

echo '</div>';
if($counter < $limit)
echo '<hr />';
}
echo '</span>';
}
// Mode is the 5th one?
elseif($mode == 5)
{
// You want the recent comments??
// Yes? Grab em then

// Do the Query
$result = db_query("SELECT
v.*, m.realName, m.ID_MEMBER, a.subject AS aSubject, a.id AS aID,
a.category
FROM
{$tp_prefix}variables AS v
LEFT JOIN {$db_prefix}members AS m ON(m.ID_MEMBER = v.value3)
LEFT JOIN {$tp_prefix}articles AS a ON(a.id = v.value5)
WHERE
v.type='article_comment'
$cat
ORDER BY v.value4 DESC
LIMIT $limit"
,__FILE__,__LINE__);

// Yup, There is always one life saving declaration :p
$comments = array();

// Build up the blocks
while ($row = mysql_fetch_assoc($result))
{
$comments[] = array(
'id' => $row['id'], # Comment ID
'subject' => $row['value1'], # Comment Subject
'time' => timeformat($row['value4']), # Posting Time
'link' => '<a href="'.$scripturl.'?page='.$row['aID'].'#tp-comment">'.$row['value1'].'</a>', # Direct link to the comment
'article' => array(
'id' => $row['aID'], # Article the comment is posted in's ID
'subject' => $row['aSubject'], # The Article's Subject
'link' => '<a href="'.$scripturl.'?page='.$row['aID'].'">'.$row['aSubject'].'</a>', # A direct Link to article
),
'author' => array(
'id' => $row['value3'], # Author's ID
'name' => $row['realName'], # Author's Name
'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['value3'].'">'.$row['realName'].'</a>', # Author's Link
),
);
}

// Free the $result from the query's trap :P
mysql_free_result($result);

// Return the array if output method is selected as "array"
if($output_method == 'array')
return $comments;

// If it is Not "array", output the default looks.
$counter = 0;
        echo '<span class="smalltext">';
        foreach($comments as $c)
        {
$counter++;
        echo '<div>',$c['link'],'</div>';

// Show the author?
        if($show_author)
        echo 'Posted By ',$c['author']['link'];

// Show the time its posted at?
        if($show_time)
        echo '<br />At ',$c['time'];

// Show in which article the comment is posted?
if($show_articleComment)
        echo '<br />In ',$c['article']['link'];

if($counter < $limit)
echo '<hr />';
        }
}
}
 
echo '</td><td class="windowbg2" valign="middle" ><td>';
 
  articles(
$mode = 1,
$limit = 5,
$cats = array(60,1,50,167),
$show_comments = false,
$show_views = false,
$show_rating = false,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);
echo '
        </td>
    </tr>
</table>';


Where and what should I add  to have a title showing for the right tabe (for example "Newest Articles")?

Once again, thank you for your time.


JPDeni


echo '<tr class="catbg3"><td valign="middle">Θέμα </td><td>Newest Articles</td></tr>';

dimdom

#7
Replacing the

echo '<tr class="catbg3"><td valign="middle">Θέμα </td></tr>';

with

echo '<tr class="catbg3"><td valign="middle">Θέμα </td><td>Newest Articles</td></tr>';

gave me that (see picture).

I had tried that before JPDeni, but it was showing distorted...


dimdom

OK, I did it...

Recent Topics AND Recent Articles, together!

It is a mix of blocks that can be used in a php block, providing a lot of user settings...


echo '
<table>
    <tr>
        <td>';

global $scripturl;
$what=ssi_recentTopics('5', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Θέμα </td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0"

/></a>';
     
'</span></td></tr>';
  }

echo '</table>';

echo '
        </td>
        <td>';
 
function articles($mode, $limit, $cats, $show_comments, $show_views, $show_rating, $show_time, $show_category, $show_author, $show_articleComment, $output_method) {

// Da Globals!! :P
global $db_prefix, $settings, $scripturl;

// Get the $tp_prefix ready
$tp_prefix = $settings['tp_prefix'];

// The Category time!
$cat = '';
    $categories = implode(', ', $cats);
if(!empty($cats))
  $cat = "AND a.category IN ($categories)";

// Do all this stuff if Mode is not the 5th one!
// I Believe this will optimize stuff. Well Atleast there is some cutting down in these queries
if($mode != 5)
{
$subcheck = '';
// Get the mode(1-4) parameters ready
if($mode == 1)
{
$m = 'a.date DESC';
}
elseif($mode == 2)
{
$m = 'a.comments DESC';
$subcheck = 'AND a.comments > 0';
}
elseif($mode == 3)
{
$m = 'a.views DESC';
$subcheck = 'AND a.views > 0';
}
elseif($mode == 4)
{
$m = 'a.rating DESC';
}
elseif($mode == 6)
{
$m = 'RAND()';
}
else
$m = 'a.date DESC';

// Well this was the mode and parameters, begin the Queries.
  $result = db_query("SELECT
a.id AS atcID, a.date, a.category, a.subject, a.voters,
a.authorID, a.approved, a.off, a.comments, a.views, a.rating, a.useintro,
                    v.id AS catID, v.value1, v.value2, value3, v.value4, v.value5,
                    m.realName
                    FROM
                    {$tp_prefix}articles AS a
                    LEFT JOIN {$db_prefix}members AS m ON (m.ID_MEMBER = a.authorID)
LEFT JOIN {$tp_prefix}variables AS v ON (v.id = a.category)
                    WHERE
                    a.approved = 1
                    AND a.off = 0
                    $cat
$subcheck
                    ORDER BY $m
                    LIMIT $limit"
                    ,__FILE__, __LINE__);

// Do da error saving declaration! :P
$items = array();

// And do the next step :D
while ($row = mysql_fetch_assoc($result))
{
// Lets calculate the rating stuff
$rat = array();
$votes = 0;
$total = 0;
$average = 0;
$rat = explode(",", $row['rating']);

$votes = count($rat);

foreach($rat as $mm => $mval)
$total = $total + $mval;

if($votes > 0 && $total > 0)
$average = floor($total / $votes);

// And now lets build up the array
    $items[] = array(
    'article' => array(
      'id' => $row['atcID'], # Article ID
      'time' => timeformat($row['date']), # Time the article is posted on
      'subject' => $row['subject'], # Article's Subject
      'artLink' => '<a href="'.$scripturl.'?page='.$row['atcID'].'">'.$row['subject'].'</a>', # Direct link to article
      'comments' => $row['comments'], # No. Of article's comments
      'views' => $row['views'], # No. Of article's views
      'rating' => $average, # Total Article's rating
      'voters' => $votes, # No. of total votes
      'is_rated' => !empty($row['rating']), # Is it rated?
      'is_categorized' => $row['category'] != 0, # Does it have a category?
    ),
    'author' => array(
    'id' => $row['authorID'], # Author ID
      'name' => $row['realName'], # Author Name
      'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['authorID'].'">'.$row['realName'].'</a>', # Direct link to author
      ),
    'cat' => array(
      'id' => $row['catID'], # Cat ID
          'name' => $row['value1'], # Cat Name
          'link' => '<a href="'.$scripturl.'?cat='.$row['catID'].'">'.$row['value1'].'</a>', # Direct link to category
    ),
    );
}

// Free $result from the evil querys as usual :P
mysql_free_result($result);

// Output method is selected as "array"? Throw the variables back to them
if($output_method == 'array')
return $items;

// Not "array"? Throw the default output out.
$counter = 0;
echo '<table width="100%" border="0" cellspacing="1" cellpadding="4" id="RecentArticlesTBL" class="bordercolor">
<tr align="center" valign="middle" class="catbg3">
<td colspan="2"><span class="normaltext">Title:</span></td>';
// Show author column?
if($show_author)echo'
<td><span class="normaltext">Author:</span></td>';
// Show category column?
if($show_category)echo'
<td><span class="normaltext">Category:</span></td>';
// Show the time its posted on column
if($show_time)echo'
<td><span class="normaltext">Published on:</span></td>';
// Show ratings column?
if($show_rating)echo'
<td><span class="normaltext">Ratings:</span></td>';
// Show views column?
if($show_views)echo'
<td><span class="normaltext">Views:</span></td>';
// Show comments column?
if($show_comments)echo'
<td><span class="normaltext">Comments:</span></td>';
echo'</tr>';
foreach ($items as $i)
{
$counter++;
echo '<tr align="left" valign="middle">
       <td class="windowbg2">
   
       <td class="windowbg"><span class="normaltext">',$i['article']['artLink'],'</a></span>';
echo '';

// Show the author?
            if($show_author)
            echo '<td class="windowbg2"><span class="normaltext">',$i['author']['link'],'</span></td>';

// Show its category?
            if($show_category && $i['article']['is_categorized'])
            echo '<td class="windowbg"><span class="normaltext">',$i['cat']['link'],'</span></td>';

            // Show the time its posted on
if($show_time)
            echo '<td class="windowbg"><span class="normaltext">',$i['article']['time'],'</span></td>';


// Show there ratings?
if($show_rating)
{
// Is it rated?
    if($i['article']['is_rated'])
    {
        echo '<td align="center" class="windowbg2"><span class="normaltext">',str_repeat('<img src="'.$settings['images_url'].'/tpblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $i['article']['rating']),' (',$i['article']['voters'],' rates)</span></td>';
        }
// No?
        else
        {
        echo '<td align="center" class="windowbg2"><span class="normaltext"><i>Not Rated</i></span></td>';
        }


// Show the no. of views?
if($show_views)
  echo '<td align="center" class="windowbg"><span class="normaltext">',$i['article']['views'],' </span></td>';


// Show the no. of comments?
if($show_comments)
    echo '<td align="center" class="windowbg"><span class="normaltext">',$i['article']['comments'],'</a></span></td>';


    }


echo '</span></td>';
if($counter < $limit)
echo '';
}
echo '</table>';
}
// Mode is the 5th one?
elseif($mode == 5)
{
// You want the recent comments??
// Yes? Grab em then

// Do the Query
$result = db_query("SELECT
v.*, m.realName, m.ID_MEMBER, a.subject AS aSubject, a.id AS aID,
a.category
FROM
{$tp_prefix}variables AS v
LEFT JOIN {$db_prefix}members AS m ON(m.ID_MEMBER = v.value3)
LEFT JOIN {$tp_prefix}articles AS a ON(a.id = v.value5)
WHERE
v.type='article_comment'
$cat
ORDER BY v.value4 DESC
LIMIT $limit"
,__FILE__,__LINE__);

// Yup, There is always one life saving declaration :p
$comments = array();

// Build up the blocks
while ($row = mysql_fetch_assoc($result))
{
$comments[] = array(
'id' => $row['id'], # Comment ID
'subject' => $row['value1'], # Comment Subject
'time' => timeformat($row['value4']), # Posting Time
'link' => '<a href="'.$scripturl.'?page='.$row['aID'].'#tp-comment">'.$row['value1'].'</a>', # Direct link to the comment
'article' => array(
'id' => $row['aID'], # Article the comment is posted in's ID
'subject' => $row['aSubject'], # The Article's Subject
'link' => '<a href="'.$scripturl.'?page='.$row['aID'].'">'.$row['aSubject'].'</a>', # A direct Link to article
),
'author' => array(
'id' => $row['value3'], # Author's ID
'name' => $row['realName'], # Author's Name
'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['value3'].'">'.$row['realName'].'</a>', # Author's Link
),
);
}

// Free the $result from the query's trap :P
mysql_free_result($result);

// Return the array if output method is selected as "array"
if($output_method == 'array')
return $comments;

// If it is Not "array", output the default looks.
$counter = 0;
        echo '<span class="normaltext">';
        foreach($comments as $c)
        {
$counter++;
        echo '<div>',$c['link'],'</div>';

// Show the author?
        if($show_author)
        echo 'Posted By ',$c['author']['link'];

// Show the time its posted at?
        if($show_time)
        echo '<br />At ',$c['time'];

// Show in which article the comment is posted?
if($show_articleComment)
        echo '<br />In ',$c['article']['link'];

if($counter < $limit)
echo '<hr />';
        }
}
}
  articles(
$mode = 1,
$limit = 5,
$cats = array(60,1,50,167),
$show_comments = false,
$show_views = false,
$show_rating = false,
$show_time = false,
$show_category = false,
$show_author = false,
$show_articleComment = false,
$output_method = 'echo'
);
echo '
        </td>
    </tr>
</table>';


Thanks to the writers and coders of the individual blocks.

Please test it and tell me if it works ok.

JPDeni

Sorry. I didn't realize that you had nested tables.

The best way to do it would be to move the titles completely, so that your code would start with


echo '
<table>
<tr class="catbg3"><td valign="middle">Θέμα </td><td>Newest Articles</td></tr>
    <tr>
        <td>';

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';

foreach ($what as $topic)
  {