How can I limit the anchor text below to show only 50 characters?
echo '<td style="" class="pointlink"><span class="pointlink"><a href="http://'.$rowad["1site"].'">'.$rowad["1site"].'</a></td>'; How can I limit the anchor text below to show only 50 characters?
echo '<td style="" class="pointlink"><span class="pointlink"><a href="http://'.$rowad["1site"].'">'.$rowad["1site"].'</a></td>'; Alternatively, you could use CSS:
.pointlink { width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Adjust the width as needed, and an ellipsis will be automatically be used to cut off the text.
You can use the substr function to cut the text down to 50 characters
function cut_text( $text, $len ) { return strlen( $text ) > $len ? substr( $text, 0, $len ) + '...' : $text; } echo '<td style="" class="pointlink"><span class="pointlink"><a href="http://'.$rowad["1site"].'">' . cut_text( $rowad["1site"], 50 ) . '</a></td>';