Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

save_related_keywords()

Description

Saves the related keywords for a specified keyword.

This function first resolves the keyword reference for the provided keyword. It then deletes
any existing relationships for that keyword and inserts the new related keywords into the
database.

specified keyword.

Parameters

ColumnTypeDefaultDescription
$keyword string The keyword for which related keywords are being saved.
$related string A comma-separated string of related keywords to associate with the

Return

bool Returns true on success, or false on failure.

Location

include/search_functions.php lines 2851 to 2868

Definition

 
function save_related_keywords($keyword,$related)
    {
    
debug_function_call("save_related_keywords"func_get_args());

    
$keyref resolve_keyword($keywordtruefalsefalse);
    
$s=trim_array(explode(",",$related));

    
ps_query("DELETE FROM keyword_related WHERE keyword = ?", array("i",$keyref));
    if (
trim($related)!="")
        {
        for (
$n=0;$n<count($s);$n++)
            {
            
ps_query("insert into keyword_related (keyword,related) values (?,?)",array("i",$keyref,"i",resolve_keyword($s[$n],true,false,false)));
            }
        }
    
clear_query_cache("keywords_related");
    return 
true;
    }

This article was last updated 4th December 2024 09:05 Europe/London time based on the source file dated 27th November 2024 09:40 Europe/London time.