I am trying to merge two different php scripts to work in one block.
I have managed to make it but I have stucked in a (probably) simple thing...
I can not make the second table be aligned at the top as the fist one does. See attached images.
The code follows:
echo '
<table>
<tr>
<td>';
//RECENT TOPICS BLOCK
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"><font color="#4266BB"><b><font size="-2">ÃŽÂΕΑ ÃŽÅ"ÃŽâ€"ÃŽÂÎ¥ÎÅ"ΑΤΑ</font></b></font></td></tr>';
foreach ($what as $topic)
{
echo '<tr><td class="windowbg" valign="middle"><span class="smalltext">', $topic['link'];
'</span></td></tr>';
}
echo '</table>';
echo '
</td>
<td>';
// RECENT DOWNLOADS BLOCK
global $db_prefix, $scripturl;
$cats = array();
$cat = implode(',',$cats);
$categories = '';
echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle"><font color="#4266BB"><b><font size="-2">ÃŽÂΕΑ ΑΡΧΕÎâ,,¢ÃŽâ€˜</font></b></font></td></tr>';
if(!empty($cats))
$categories = "AND f.ID_CAT IN($cat)";
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
$categories
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<td class="windowbg" valign="middle"><span class="smalltext"><a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></span></td>
<td class="windowbg" align="right"><span class="smalltext">',$row['totaldownloads'],'</a></span></td>
</tr>
</table>';
}
echo '
</td>
</tr>
</table>';
Any help will be greatly appreciated!
You appear to have one table in another table - that's what is causing the problem. I would try making the whole of the information appear in just one table - then whenever one cell is slightly bigger than another one all the other rows will expand to match it's size.
Thanks, freddy!
And how do I do that exactly? 8)
Well I would learn some HTML ;D ;)
Is this using the downloads mod you were saying about in the other tabbed block thread ?
If it is then can you drop me a link and I will download it now.
Then I can help better.
I am an amature, I know... :P
The mod is here: http://custom.simplemachines.org/mods/index.php?mod=992
If you look at this link in my site, youll see that I have managed ...half the proccess...
http://www.authorway.com/SMF/index.php?page=33
Ii is aligned vertically, after removing the
echo '
</td>
<td>';
code...
And here is the php file that I am working on that includes recent articles, recent topics and recent downloads (attached).
Thanks :)
OK so just let me get this right - you want all three things to align up side by side in one block or article ? Rather than vertically ?
Yes, like the pictures in my first post...
And if possible, I would all three blocks to have the same icon at the left of every title (like the recent articles block).
I want a lot, i know few... :laugh:
OK leave it with me for a bit. I need to figure out how this new downloads mod works. Maybe you can help me - how do I add a category ? I can't seem to find out how to do it.
downloads first page, at the bottom.
Got it thanks :)
OK that was a bit more complicated than I expected. Basically to do this I took the output from each bit and put it all into an array. Then at the end it was simple to just output the array into the table.
File is attached, don't forget to remove the PHP tag at the top.
The language in the articles function may be corrupted because I don't have that language here, but it doesn't matter as you don't use that part of the code - in fact you could strip a lot of that out if you wanted.
You'll just need to change the headings I did in English near the end of the file.
Excellent work and very fast!
QuoteFile is attached, don't forget to remove the PHP tag at the top.
In fact, i find it more convenient to use the
include('recentsBlock.php');in a php block while my recentsBlock.php is in the forum directory...
Once again, great work!
Ah yes, good thinking on the include, I find editing live in TP a bit difficult sometimes and there are no line numbers to help.
Thanks for the screenshot :) Glad it works.
Mind if I add this to the block code and snippets board in case anyone else likes it ?
Go ahead...
it is mostly your work after all!