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 1940 to 1951

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 27th April 2024 09:05 Europe/London time based on the source file dated 15th April 2024 11:30 Europe/London time.