pageIdExists (function)

Last updated: Mon, Apr 17, 2023 1:16 pm
Return to Knowledgebase

Purpose

Tells whether a page id is used in UserSpice

Location

users/helpers/permissions.php

Parameters

# Parameter Data Type Required Description
1 $id integer Yes the ID of the page to check

Returns

Data Type Description of Returned Data
bool Returns a boolean value (true or false) indicating whether a page with the given ID exists in the pages table of the database.

Example

pageIdExists(1)

Further Documentation:

Example Usage:

if(pageExists(1)){
echo 'this is a valid UserSpice page id';
}


In this example, the function checks if there is a page with ID of 10 in the database. If there is, it will output "Page exists", otherwise it will output "Page does not exist".