Hi,
I would like to limit the number of characters to e.g 100 that are retrieved from the database in short_description. There can be an indefinite number of characters held in the database for short_description but for display purposes I only want to display the first 100 characters or first 8 words.
Amy ideas please. Totally new to this. The code is below. THANKS!!!
$sql = " SELECT item_id, item_title, friendly_url, date_start, short_description ";
$sql .= " FROM " . $table_prefix . "ads_items ";
$sql .= " WHERE item_id IN (" . $db->tosql($items_ids, INTEGERS_LIST) . ") ";
$sql .= " ORDER BY date_start DESC, date_added ";
$db->query($sql);
if($db->next_record())
{
$latest_columns = get_setting_value($page_settings, "ads_latest_cols", 1);
$t->set_var("latest_column", (100 / $latest_columns) . "%");
$latest_number = 0;
do
{
$latest_number++;
$item_id = $db->f("item_id");
$item_title = get_translation($db->f("item_title"));
$friendly_url = $db->f("friendly_url");
$[COLOR="red"]short_description [/COLOR]= get_translation($db->f("short_description"));
$t->set_var("item_id", $item_id);
$t->set_var("latest_item_title", $item_title);
$t->set_var("[COLOR="red"]short_description[/COLOR]", nl2br($[COLOR="red"]short_description[/COLOR]));