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 1955 to 1966

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 23rd July 2024 20:35 Europe/London time based on the source file dated 8th July 2024 10:20 Europe/London time.