Commit 5d420438 authored by Romain Loth's avatar Romain Loth

fix keywords display in directories

parent 1b04d79f
......@@ -178,7 +178,7 @@ foreach ($scholars as $scholar) {
if ($scholar['keywords'] != null) {
// TODO change strategy : add email, check if we want to keep phone
// if (($scholar['keywords'] != null) || ($scholar['address'] != null) || ($scholar['phone'] != null)) {
$content .= '<div class="span3" align="justify">';
$content .= '<div class="span3" align="left">';
if ($scholar['keywords'] != null){
$content .= '<i class="icon-tags"></i> ' . clean_exp($scholar['keywords']). '.<br/><br/>';
......
......@@ -68,4 +68,21 @@ function sanitize_input($value) {
return $value;
}
// for html display of concatenated lists
// to make spaces insides the elements unbreakable
function split_join_keywords_for_html($str_value) {
$arr = explode(',', $str_value);
$mod_arr = [];
foreach ($arr as $kw) {
if (strlen(str_replace(' ', '', $kw))) {
$mod_kw = str_replace(' ', '&nbsp;', $kw) ;
array_push($mod_arr, $mod_kw);
}
}
return join(', ', $mod_arr);
}
?>
......@@ -316,7 +316,7 @@ foreach ($base->query($sql) as $row) {
// retrieved from secondary table and GROUP_CONCATenated
$info['keywords_ids'] = explode(',', $row['keywords_ids']);
$info['nb_keywords'] = $row['keywords_nb'];
$info['keywords'] = $row['keywords_list'];
$info['keywords'] = split_join_keywords_for_html($row['keywords_list']);
// $info['status'] = $row['status'];
......
......@@ -155,7 +155,7 @@ foreach ($base->query($sql) as $row) {
// retrieved from secondary table and GROUP_CONCATenated
$info['keywords_ids'] = explode(',', $row['keywords_ids']);
$info['nb_keywords'] = $row['keywords_nb'];
$info['keywords'] = $row['keywords_list'];
$info['keywords'] = split_join_keywords_for_html($row['keywords_list']);
// $info['status'] = $row['status'];
$info['record_status'] = $row['record_status']; // TODO use this one
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment