What am I missing here?
I’ve created a vertical menu application (desk_computers) and I’m populating it with results from a MySQL database connection. In the onLoad command, here’s what I have:
sc_appmenu_reset(desk_computers);
sc_appmenu_create(desk_computers);
if(!empty([customer_id]) && is_int([customer_id])) { $customer_id = “=” . [customer_id]; } else { $customer_id = " LIKE ‘%’"; }
if(!empty([location_id]) && is_int([location_id])) { $location_id = “=” . [location_id]; } else { $location_id = " LIKE ‘%’"; }
$q_list = “SELECT inventory_id, device_id, updated FROM customers_inventory WHERE activeflag_id=1 AND customer_id” . $customer_id . " AND location_id" . $location_id . " ORDER BY device_id ASC;";
sc_lookup(r_list, $q_list);
if(isset({r_list})) {
for($list=0; $list < count({r_list}); $list++) {
$item_id = ‘item_’ . {r_list[$list][0]};
$parent_id = ‘’;
$label_id = {r_list[$list][1]};
$app_id = “desk_computer_details”;
$param_id = “inventory_id=” . {r_list[$list][0]};
$icon_id = “companies.png”;
$hint_id = {r_list[$list][1]};
$target_id = ‘_self’;
sc_appmenu_add_item(‘desk_computers’, $item_id, $parent_id, $label_id, $app_id, $param_id, $icon_id, $hint_id, $target_id);
}
}
This generates without an error, but when you run it, you get a blank screen, which is indicative of a PHP error somewhere. So I use PuTTY to SSH into my development server, and I use “tail -f” to look at /var/log/apache2/error.log while loading the page. I get the following error:
[Wed Sep 13 13:00:40.118522 2023] [proxy_fcgi:error] [pid 1231722] [client 192.168.1.88:52445] AH01071: Got error ‘PHP message: PHP Parse error: syntax error, unexpected double-quoted string “*scout” in /var/www/html/scriptcase/app/unity/desk_computers_menu/index.php on line 1171’, referer: http://192.168.1.8/scriptcase/devel/iface/editor.php?randjs=AshzG8Cxv6cMbgqI
OK so PHP sees a syntax error of some sort. I use “nano” to go look at what that line of code looks like, and here’s what I see (you’ll have to scroll right):
$_SESSION['scriptcase']['sc_def_menu']["desk_computers"][$item_id]['parm'] = $param_id . "*scin""*scout" . "nm_run_menu*scin1*scout";
This problem has been reported before, and I was told by the netmake folks that it was “not a bug.” Except, when I look at this, no matter what I put in the $param_id variable (even blank, like two double quotes) my code won’t run. If I exclude $param_id from the sc_appmenu_add_item command, it runs. Example:
sc_appmenu_add_item(‘anydesk_computers’, $item_id, $parent_id, $label_id, $app_id, , $icon_id, $hint_id, $target_id);
So, scriptcase is generating code with a syntax error, even if my $param_id variable is populated with valid parameter data.
Am I missing something crucial here? I need to be able to pass variable data to applications when menu items are clicked on…