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

get_node_id()

Description

Return a node ID for a given string


integer = node ID of matching keyword.

Parameters

ColumnTypeDefaultDescription
$value string The node name to return
$resource_type_field integer The field to search

Return

false|int false = not found

Location

include/node_functions.php lines 1966 to 1977

Definition

 
function get_node_id($value,$resource_type_field)
    {
    
// Finding a match MUST distinguish nodes which are different only by diacritics or casing
    
$node ps_query(
        
'SELECT ref FROM node WHERE resource_type_field = ? AND `name` = BINARY(?)',
        [
            
'i',$resource_type_field,
            
's',$value,
        ]
    );
    return 
count($node) > $node[0]['ref'] : false;
    }

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