SmashedPumpkins
11-25-2009, 07:05 PM
I'm pulling a huge description from a database and I'd like to show only the first 150 characters or so. After of which it'll have a view more button. I have the code, but it may be a tad confusing to look at. It's looping data that is put into arrays. The description is "rex_details".
<?php
foreach($rows as $row)
{
printf ("
<div class='member_tab'> <a href='/dates.php?id=%s'><img src='%s' heigth='78' width='108' class='photo' /></a>
<div class='member_details'> <a href='/dates.php?id=%s' class='linkfix'><span>%s</span></a><br />
<p>%s</p>
<a href='/dates.php?id=%s' class='more'>more</a>
</div>
</div>
</div>
",$row['rex_id'],$row['rex_url'],$row['rex_id'],$row['rex_title'],$row['rex_details'],$row['rex_id']);
}
?>
<?php
foreach($rows as $row)
{
printf ("
<div class='member_tab'> <a href='/dates.php?id=%s'><img src='%s' heigth='78' width='108' class='photo' /></a>
<div class='member_details'> <a href='/dates.php?id=%s' class='linkfix'><span>%s</span></a><br />
<p>%s</p>
<a href='/dates.php?id=%s' class='more'>more</a>
</div>
</div>
</div>
",$row['rex_id'],$row['rex_url'],$row['rex_id'],$row['rex_title'],$row['rex_details'],$row['rex_id']);
}
?>
