parseMenuLabel (function)

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

Purpose

Used to parse a label string for a menu item.

Location

users/helpers/menus.php

Parameters

# Parameter Data Type Required Description
1 $string string Yes The label string to be parsed.

Returns

Data Type Description of Returned Data
string Representing the parsed label.

Further Documentation:

Example usage:



$menuLabel = "{{WELCOME_MESSAGE}}, {{LOGGED_IN_USERNAME}}";
$welcomeMessage = "Welcome to my website!";
$parsedLabel = parseMenuLabel($menuLabel);
echo $parsedLabel;



In the example above, the function will replace {{WELCOME_MESSAGE}} with the value of $welcomeMessage, and {{LOGGED_IN_USERNAME}} with the logged-in user's username (if the user is logged in). The resulting string will be echoed to the page.