This topic is locked

Menu from a php file

7/10/2026 06:58:03
PHPRunner General questions
S
Svic srl author

Hi,
is there a way to use an external php file instead phprunner menu?

Sergey Kornilov admin 7/10/2026

The menu is not a file, it is much more than that. May be you can explain what exactly you need to implement and we can suggest a solution?

S
Svic srl author 7/13/2026

Well,
I have an application managed partly with PHRunner and for other functions with PHP scripts. Every time a new feature is created, I don't want to open the PHPRunner project to add an external link. I'd like to disable the PHPRunner menu and use a PHP file with links to the various pages, both PHPRunner and external.

C
Chris Whitehead 7/13/2026

You could use the modify menu function

https://xlinesoft.com/phprunner/docs/menu_modify.htm

$item = $menu->addPageLink( "New Cars", "cars", "list" );
$item->openNewWindow( true );

$group = $menu->addGroup( "Links" );
$menu->addURL( "Google", "https://google.com", $group->id );

Then use the permissions.
https://xlinesoft.com/phprunner/docs/secapi_set_permissions.htm

$rights = Security::getPermissions("Cars");
$rights["A"] = true;
$rights["D"] = false;
Security::setPermissions("Cars", $rights);

You could then include the PHP in the modify menu event, then run a loop in side it.

Or do you need a list of all the tables in the project so you can loop through those and build the menu dynamically?

S
Svic srl author 7/14/2026

Chris Whitehead,
Thanks but your solution requires the use of phprunner. I need to include this php file instead phprunner menu.

<div class="sidebar">

<i class="fa-solid fa-layer-group"></i> TaskFlow Pro

<a href="home.php"><i class="fa-solid fa-chart-line"></i> Dashboard</a>
<a href="Temp_Monitor.php"><i class="fa-solid fa-temperature-high"></i> Temp Monitor</a>
<a href="control_room.php"><i class="fa-solid fa-traffic-light"></i></i> Control room</a>
<a href="fire_prev.php"><i class="fa-solid fa-fire-extinguisher"></i> Fire prevention</a>
<a href="CCTV.php"><i class="fa-solid fa-video"></i> CCTV</a>



<a href="admin_rights_list.php"><i class="fa-solid fa-screwdriver-wrench"></i> Admin panel</a>
<a href="login.php?a=logout"><i class="fa-solid fa-door-open"></i></i> Logout</a>
</div>

Because one team will develop the various sensor and video management pages, while I'll manage the monitoring and data acquisition with PHPrunner. I don't want to open the project and recompile the menu every time the sensor team wants to add a new page. They'll just add a new link to the PHP file and it'll be ready to go.

Sergey Kornilov admin 7/14/2026

Create a file named mymenu.php and add a redirect to this page in Welcome page: BeforeProcess event.

C
Chris Whitehead 7/22/2026

@Svic srl

Updated - HTML does work if the single and double quotes are swapped positions , double quotes round the string and single in any html

You don't need to recompile each time, you can just include a php script in the modify menu event, this would simply be an array which contains the url, then your team just adds an item to the array in the script which is getting included.

$menu_items = [
[
'href' => 'home.php',
'text' => 'Dashboard',
'icon' => 'fa-solid fa-chart-line'
],
[
'href' => 'Temp_Monitor.php',
'text' => 'Temp Monitor',
'icon' => 'fa-solid fa-temperature-high'
],
[
'href' => 'control_room.php',
'text' => 'Control room',
'icon' => 'fa-solid fa-traffic-light'
],
[
'href' => 'fire_prev.php',
'text' => 'Fire prevention',
'icon' => 'fa-solid fa-fire-extinguisher'
],
[
'href' => 'CCTV.php',
'text' => 'CCTV',
'icon' => 'fa-solid fa-video'
],
[
'href' => 'admin_rights_list.php',
'text' => 'Admin panel',
'icon' => 'fa-solid fa-screwdriver-wrench'
],
[
'href' => 'login.php?a=logout',
'text' => 'Logout',
'icon' => 'fa-solid fa-door-open'
]
];

foreach ($menu_items as $item)
{
$group_id = 0;

$menu->addURL(
"<i class='".$item['icon'] ."'></i> " . $item['text'],
$item['href'],
$group_id
);
}

img alt

Another option could be to create another dummy item then copy it, this would have the icon and you just replace it using JS

This might help with the icon as there doesn't appear to be any phprunner documented functions to add/replace icons, it is for a previous version but still works.
https://xlinesoft.com/blog/2016/01/06/adding-badges-to-application-menu/

Here's some code I use to add the badges/icons which is in MenuItem:Modify, this still works but it's deprecated so I don't know how long this would still work for.
https://xlinesoft.com/phprunner/docs/menu_item_modify.htm


$title = $menuItem->getTitle();// get the title which is added in the modify menu event

// check if the title matches and append on the badge, you could just prepend as well.
if ($title=="Calendars") {
// display some text
$title .= '<span class="label label-warning pull-right" >New</span>';
$menuItem->setTitle($title);
}
if ($title=="Dashboard") {
$title.="<span class='label label-warning' style='float:right'>Updated</span>";
$menuItem->setTitle($title);
}
if ($title=="Suppliers") {
// display some image
$title.="<span class='badge'><img src='images/cal.gif'></span>";
$menuItem->setTitle($title);
}
if ($title=="Customers") {
// display numbers of today's orders
$query = 'SELECT count(*) FROM sales WHERE DATE(OrderDate) = CURDATE()';
$query = 'SELECT count(*) FROM customers ';
$count = DBLookup( $query );
$title.="<span class='badge badge-blue' style='float:right'>".$count."</span>";
$menuItem->setTitle($title);
}
if ($title=="Sales") {
// display numbers of today's orders
$query = 'SELECT count(*) FROM sales WHERE DATE(OrderDate) = CURDATE()';
$query = 'SELECT count(*) FROM sales ';
$count = DBLookup( $query );
$title.="<span class='badge badge-red' style='float:right'>".$count."</span>";
$menuItem->setTitle($title);
}