Menu syntax

Menus serve various purposes within Appzio apps. They send commands to backend, direct the users flow and provide navigation.

Menus intro

You can find menus in several places in the application:
– side menu
– top right menu
– anywhere within the article view

This section deals with the more technical syntax of menus, not about administering them using the admin interface.

Menu items can be triggered by:
– any of the in-built menu items (side menu, top right)
– menu item within an article
– onClick item which is attached to any article element
– onLoad within the main body

Menus in PHP code

Menu can be either an individual element or an array. If its an array, the client will execute all the menu commands in order in which they are defined. On the examples first example would open an action upon click. Second example would open action & then execute list-branches which updates all the data from the server. Second example you would use, if your code manipulated somehow the state of the app (hiding / showing actions / modifying some content).


/* Attaching a menu to an image: */

        $onclick = new StdClass();
        $onclick->action = 'open-action';
        $onclick->sync_open = 1;
        $onclick->back_button = 1;
        $onclick->id = $id;
        $onclick->action_config = $detail_view;

        $options['onclick'] = $onclick;
        $options['imgwidth'] = 600;
        $options['imgheight'] = 600;
        $options['imgcrop'] = 'yes';
        $options['crop'] = 'yes';

        $profilepic = $this->getImage($profilepic,$options);

/* Attaching two menu commands to the same image */

        $onclick = new StdClass();
        $onclick->action = 'open-action';
        $onclick->sync_open = 1;
        $onclick->back_button = 1;
        $onclick->id = $id;
        $onclick->action_config = $detail_view;

        $onclick2 = new StdClass();
        $onclick->action = 'list-branches';

        $options['onclick'] = array($onclick,$onclick2);
        $options['imgwidth'] = 600;
        $options['imgheight'] = 600;
        $options['imgcrop'] = 'yes';
        $options['crop'] = 'yes';

        $profilepic = $this->getImage($profilepic,$options);

Using menus to control the flow

Menus are the main way to control the flow of the application. The simplest example:

/* menu code for the view */
$onclick = new stdClass();
$onclick->action = 'submit-form-content';
$onclick->id = 'submit-name';
$this->data->scroll[] = $this->getText('Submit name',array('onclick' => $onclick);

/* controller code */
if($this->menuid == 'submit-name'){

Here is an example, where we open an item:

/* menu code for the view */
$onclick = new stdClass(); $onclick->action = 'submit-form-content'; $onclick->id = 'open-item-'.$id; $this->data->scroll[] = $this->getText('Open item',array('onclick' => $onclick);
/* controller code */
  $id = str_replace('open-item-','');

Here we pass the parameter using a helper:

/* menu code for the view */
$parameters['id'] = 'fundamental-selected';
$parameters['params']['id_recipient'] = $recipient;
$parameters['params']['id_fundamental'] = $id;
$this->data->scroll[] =  $this->getRow($col,array(,'onclick' => $this->getOnclick('submit',true,$parameters)));
/* controller code */
if($this->menuid == 'fundamental-selected'){
  $detail_id = $this->getClickParam('id_recipient');
  $fundamental_id = $this->getClickParam('id_fundamental')

Available menu parameters

Menu is defined within PHP code like this:

$onclick = new StdClass();

From here you will find a reference list of all the parameters a menu command supports. Note, that not all parameters are available for all menu commands. For example action share, takes no additional parameters.

action (string)
This is what the menu does. Explanation of available actions in another document.

id (alphanum)
ID that will get submitted back to the server. This is the main parameter we use to control the flow of the application. One way to pass an id of an item, would be to incorporate it with this id, though there are other ways.

action_config (generally num)
This is used for example by open-action and open-branch commands to indicate what to open. For example, you could write it like this:

$complete = new stdClass();
$complete->action = 'open-branch';
$complete->action_config = $this->getConfigParam('register_branch');

variable (num)
If menu command ties in with the variable, you can give its ID here. For example, uploading of images. Note that this is an ID rather than the variable name. You can extract a variable’s id using


sync_open (0 or 1)
If this is defined with open-action or open-branch, the client will do a refresh of the target action before showing it. Use this only if you have to, as it has an effect on the responsiveness. You can also use  action’s own “update_on_open” configuration parameter which makes the update after loading the view and updates it without loader.

back_button (0 or 1)
If you want client to return to this view when user presses the back-button, you should set this to 1.

fallbackimage (image filename)
This only applies to image components. You can have the client replace the clicked image into something else before the turn around to server happens.

open_popup (0 or 1)
Used with open-action or open-branch. Will open the target into a new popup window. Popup windows can always be closed clicking outside of the window, so consider this when using popups.

sync_upload (0 or 1)
If the menu command is for upload, you can force it to work synchronously and wait for the upload to finish before letting user to continue. By default, uploads are async.

max_dimensions (num)
Refers only to image uploads. You can force the client to resize the image before sending it to server. Takes a numeric value which refers to maximum width or height in pixels.

viewport (top | current | bottom)
Sets where the viewport should be after the click.

Available menu commands

This is the most common form action. This will keep the user in the same action, but pass a menu id to server and refresh the view.

Same as previous, but uses a full screen loader.

Opens another tab within the view. For example:

$openinfo = new stdClass();
$openinfo->action = 'open-tab';
$openinfo->action_config = 3;
$openinfo->id = $id;

Requires ID of the target action. Example:

$openinfo = new StdClass();
$openinfo->action = 'open-action';
$openinfo->id = $id;
$openinfo->action_config = $this->getConfigParam('detail_view');
$openinfo->open_popup = 1;
$openinfo->sync_open = 1;

Requires ID of the target branch.

Launches the mobile built-in share dialog that allows to share the current action. See the share parameters under the action’s advanced tab. These can be overriden from the code using $this->rewriteActionConfigField(‘key’,’newvalue’).

Opens url using device’s default browser.

Triggers Facebook login dialog.

Logs out from Facebook.

fb-appinvite (only for game apps)
Sends an app invitation via Facebook.

Shows Facebook invite dialog.

Triggers Twitter login dialog.

Logs out from Facebook.

Completes (and closes) the current action. For example registration uses this to close the registration action once everything is complete.

Uploads image. Must have a variable parameter defined. For example:

$onclick = new stdClass();
$onclick->action = 'upload-image';
$onclick->sync_upload = 1;
$onclick->viewport = 'bottom';
$onclick->max_dimensions = '600';
$onclick->allow_delete = true;
$onclick->variable = $this->factoryobj->getVariableId('chat_upload_temp');

Uploads video. Must have a variable parameter defined.

Uploads sound. Must have a variable parameter defined.

Goes to home action / main menu view.

Triggers a location request and updates lat and lon variables on the server.

Starts region monitoring (GPS).

Will stop ALL region monitoring.

Stops monitoring a specific region.

Scans for beacons nearby. This is an expensive function, so normally you would rely on region monitoring rather than this. Its mainly for administering the beacons.

Forces the client to update all app’s content (aka branch listing).

Opens interstitial advertising.

If view has a swipe stack, will trigger a swipe to left.

If view has a swipe stack, will trigger a swipe to right.

Will trigger an inapp-purchase dialog. Example:

$onclick = new StdClass();
$onclick->action = 'inapp-purchase';
$onclick->id = 'product_' . $amount;
$onclick->product_id_ios = $id_ios; // Should be replaced with an id
$onclick->product_id_android = $id_android;
$onclick->producttype_android = 'inapp';
$onclick->producttype_ios = 'inapp';

Triggers a dialog to restore previous purchase.

Asks for iOS push notification permission. This needs to be called at some point to enable push message sending to client.

Check whether app can open another app url. For example:

$checker = new stdClass();
$checker->action = 'check-scheme';
$checker->variable = 'otherapp_installed';
$checker->action_config = 'fb://';

Launches a braintree purchase process.