Dialogs Framework Basic Concepts
Dialogs Feature: Tags (Keywords)
Updated: 21 Apr 2023
- populate the Keywords List (Setup) with appropriate Tags or Keywords
NOTE: Dialogs v.8 doesn't ship with a Keywords list, but it is very easily added. Just create a list named C_keywords, and enter your values. No additional fields are usually needed. - add an LRP field to more than one Dialogs List
- populate the Keywords LRP for individual list items (content) on BOTH Lists (often, one of the Lists is the Pages List)
- add the following function to
/inc/custom_functions.inc.php
/////////////////////////////////////////////////////////// // BUILD_LRP_WHERE /////////////////////////////////////////////////////////// function build_LRP_where($field_name,$field_values) { $sql_where = ''; $field_value_array = myExplode(',',$field_values,'|'); foreach($field_value_array as $field_value) { if($sql_where) { $sql_where .= ' OR '; } else { $sql_where = ' ('; } $sql_where .= "$field_name LIKE '%|" . addslashes($field_value) . "|%'"; } if($sql_where) { $sql_where .= ' )'; } return $sql_where; }
- create a List Template to show related content
- call the List Template from within a Page Template or (detail) List Template specifying the WHERE clause:
// This would go in a page template $whereclause="item_active=1 AND " . build_LRP_where('keywords',$this->db_page_row[keywords]); $this->Show_List('list_related_studies.', array('view_where'=>$whereclause)); // This is how you would use it in a list template $whereclause="item_active=1 AND " . build_LRP_where('keywords',$row[keywords]); // when searching items on the SAME list, exclude the detail you're viewing $this->Show_List('list_related_articles.', array('view_where'=> 'item_id !=' . $row[item_id] . ' AND ' . $whereclause)); //when searching other Lists, just use $whereclause built above $this->Show_List('list_related_studies.', array('view_where'=>$whereclause));
- Create a page using the Page Template or calling the List Template with the defined Show_List
Next: Dialogs Installation