TinyPortal

Development => Block Codes => Topic started by: coldthunder on April 10, 2008, 12:51:53 PM

Title: smalltext for the following code snipet
Post by: coldthunder on April 10, 2008, 12:51:53 PM
I got the following code off of this area here and i like it, but the text shows up bigger than the others in my other blocks. How can i add the "smalltext" code into it so it displays it in small text?  thanksglobal $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);

$query = db_query(
    "SELECT realName, lastLogin
     FROM {$db_prefix}members
     WHERE lastLogin > $starttime
     ORDER BY lastLogin DESC", __FILE__, __LINE__);

echo "<table>";
while ($row = mysql_fetch_assoc($query))
{
  echo "<tr><td>";
  echo $row['realName'];
  echo "</td><td>";
  echo timeformat($row['lastLogin']);
  echo "</td></tr>";
}
echo "</table>";
Title: Re: smalltext for the following code snipet
Post by: Jpg on April 10, 2008, 12:56:39 PM
Change-
<table>

To-
<table class="smalltext">

Or you can change it to-

<table style="font-size: 10px;">
Title: Re: smalltext for the following code snipet
Post by: coldthunder on April 10, 2008, 03:17:45 PM
tried both of those and got the same error

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/thundazo/public_html/smf/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 11

i tried also change the </table> at end to match </table class> and </table sytle> and that didnt work either
Title: Re: smalltext for the following code snipet
Post by: ed_m2 on April 10, 2008, 03:39:05 PM
it thinks the " around smalltext is the end of your echo command.

use something like:

echo '<table class="smalltext">';

or maybe the other way around... i forget  ::)
Title: Re: smalltext for the following code snipet
Post by: coldthunder on April 10, 2008, 03:47:44 PM
that didnt work either, didnt error just kept the same size
Title: Re: smalltext for the following code snipet
Post by: Jpg on April 10, 2008, 04:18:34 PM
I'm guessing you don't know php.
Well here's the code for you.

global $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);

$query = db_query(
    "SELECT realName, lastLogin
     FROM {$db_prefix}members
     WHERE lastLogin > $starttime
     ORDER BY lastLogin DESC", __FILE__, __LINE__);

echo '<table class="smalltext">';
while ($row = mysql_fetch_assoc($query))
{
  echo '<tr><td>';
  echo $row['realName'];
  echo '</td><td>';
  echo timeformat($row['lastLogin']);
  echo '</td></tr>';
}
echo '</table>';


You were using -> " instead of -> '
Title: Re: smalltext for the following code snipet
Post by: coldthunder on April 10, 2008, 05:33:19 PM
Thank you
Title: Re: smalltext for the following code snipet
Post by: Jpg on April 10, 2008, 05:40:02 PM
Your welcome. :D