I'm wondering, is there any easy way to limit the amount of characters that display in a text string and add ... at the end?
example:
I went to the store today
I went to the stor...
How it will be used:
I have an array, built from a database, that is being used to fill a drop down menu. The menu is too wide, so I want to limit the text characters to display 20-30 characters. This way if a text string from the database is too long, it wont make the window wider than I want it.
Here is the loop and coding that builds my drop down menu:
Code: Select all
<select name="select" onChange="MM_jumpMenu('parent',this,0)">
<option value="" <?php if (!(strcmp("", $row_BookTitlesї'ID']))) { if ($BookSelected != 1) {echo "SELECTED";}} ?>>Select a Book</option>
<?php do { ?>
<option value="index.php?bookSelected=1&BookID=<?php echo $row_BookTitlesї'ID']?>"<?php if (!(strcmp($row_BookTitlesї'ID'], $row_BookTitlesї'ID']))) { if ($HTTP_GET_VARSї'BookID'] == $row_BookTitlesї'ID']) { echo "SELECTED"; } else { echo "";}} ?>><?php echo $row_BookTitlesї'BTitle']?></option>
<?php } while ($row_BookTitles = mysql_fetch_assoc($BookTitles));
$rows = mysql_num_rows($BookTitles);
if($rows > 0) {
mysql_data_seek($BookTitles, 0);
$row_BookTitles = mysql_fetch_assoc($BookTitles);
}
?>
</select>Code: Select all
<?php echo $row_BookTitlesї'BTitle']?>