Add External Menu in PHPMaker

PHPMaker Tutorial Series

Paramita Daniswari
3 min readJun 16, 2023

Hi All, welcome to PHPMaker Tutorial Series.

Sometimes in developing website, we want to add external link as a menu in our website so called External menu. External menu in PHPMaker means we integrate our website with another link that once we click the link, it will open in new tab. We don’t need to leave our page just to open the external link. Since PHPMaker is unique, we can’t directly tell the menu target to be blank, so we need to configure it.

Here’s the tutorial to add external menu in PHPMaker.

1. Let’s open our project.

Our project file ends with .pmp and here’s my project file looks like

Figure 1. PHPMaker Project

2. Add Menu

Click menu icon and Menu editor window will be pop out. Add Title of our new menu and paste our external url on url column as shown below.

Figure 2. Add new menu

3. Generate project

Figure 3. Generate the Project

4. Find The Secret Number

Open root directory, find menu.php. This file can be find in folder <root folder>/view/.

Figure 4. Location of menu.php

Open menu.php in notepad or vscode, then find the ‘secret number’ of our new external menu.

Figure 5. Find the ‘secret number’

in this case, 293 is my secret number of the external menu i already added before. Take a notes then back to our project

5. Configuring the Server Codes

Go to sever_codes and click menu rendering. Paste this code inside the bracket code of menu rendering.

function Menu_Rendering($menu)
{
// Change menu items here
$menu->FindItem(293)->Target = "_blank";
}
Figure 6. Configure Server Code for Menu

6. Generate The Project Again

and Try it out !

External Menu will be shown at sidebar.

Figure 7. New External Link Shown

As configured before, after we click the sidebar menu, browser will open new page without closing the current tab as shown below.

Figure 7. Opening External Menu without Closing The Existing One

That is. Hope it helps !

--

--

Paramita Daniswari
Paramita Daniswari

Written by Paramita Daniswari

Programming Enthusiast - The written words yearn for timeless wings

No responses yet