I have added a new menu item through menuitem_adding server event.
I want to open that specific menu item in new tab.How it is possible ?
This might help: How to Open A Page in New Tab from Menu Item (v2021) which should work also for v2022 and v2023.
Can i transfer some global variables with that method ?
For example : CurrentUserID() to a Custom File ?
Actually, I don’t want to use CurrentUserID() as it is in Custom File
I don’t think your last question above is related to the current topic as you explained in first post above.
Actually, i want when i open that specific menu item,
the current user id value should transfer to Custom File on blank page.
which is a separate php file
Did you mean you want to append a param into the current URL of the menu item?
Yes. Exactly that is. Please help
For example:
if ($item->Url == "mycustomfile") {
if (IsLoggedIn())
$item->Url = "mycustomfile?myUserID=" . CurrentUserID();
}
My custom file is a .php file and its path is localhost/crm22/myfiles/kpisrep.php (with ‘Include Common File Un-Checked’).
I tried it like below, but nothing is working.
if ($item->Url == "kpisrep") {
$item->Target = "_blank";
}
if ($item->Url == "kpisrep") {
$item->Url = "kpisrep.php?myUserID=" . CurrentUserID();
}
return true;
Make sure you can display the simple output from your Custom File by calling its URL first.