Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_grouped_related_keywords()

Parameters

ColumnTypeDefaultDescription
$find ""
$specific ""

Location

include/search_functions.php lines 2615 to 2641

Definition

 
function get_grouped_related_keywords($find="",$specific="")
    {
    
debug_function_call("get_grouped_related_keywords"func_get_args());

    
# Returns each keyword and the related keywords grouped, along with the resolved keywords strings.
    
$sql="";$params=array();

    if (
$find!="")
        {
        
$sql="where k1.keyword=? or k2.keyword=?";
        
$params[]="s";$params[]=$find;
        
$params[]="s";$params[]=$find;
        }
    if (
$specific!="")
        {
        
$sql="where k1.keyword=?";
        
$params[]="s";$params[]=$specific;
        }
    
    return 
ps_query("
        select k1.keyword,group_concat(k2.keyword order by k2.keyword separator ', ') related from keyword_related kr
            join keyword k1 on kr.keyword=k1.ref
            join keyword k2 on kr.related=k2.ref
        
$sql
        group by k1.keyword order by k1.keyword
        "
,$params);
    }

This article was last updated 19th March 2024 04:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.