One of the great features in PHPMaker is the ability to create the pull-down menu easily with a nice and modern view in your web application. This menu also supports for horizontal or vertical style you may choose. Generally, we will use this menu feature in order to access our generated pages and open them in the same window of the browser. Sometimes, we also want to create menu items that can be opened in new window or tab of the browser from our web application. For example, we want to include some useful links to open the external websites that can be opened from the menu that generate with PHPMaker. When users click on one of those menu items, then it should open a new window or tab, so our current opened page will still stay in the browser, and not be replaced by that external website page.
Unfortunately, PHPMaker has not provided the settings from its Menu Editor in order to make the certain menu items can be opened in a new window or tab. So, this following customization will show you how to make the menu can be opened in new window or tab of the browser. I have successfully customized the template file to make it comes true, and it works perfectly. In other words, we will not customize the generated pages at all. A simple modification though, yet so powerful.
[hidepost]
- Open your /Script/ewshared.php file, and find this code:
$this->GroupTitle = $grouptitle;
after that line, please insert the following code:
// Begin of modification by Masino Sinaga, April 23, 2012, in order to support _blank target in URL if it contains the prefix http if (strpos($this->Url, "http://")!==FALSE) { $this->Target = "_blank"; } // End of modification by Masino Sinaga, April 23, 2012, in order to support _blank target in URL if it contains the prefix http - Go to Menu Editor menu. Create your own new menu items by using PHPMaker application, and make sure in the URL column you have included the prefix http:// for that new menu item.
- Save the project, and then re-generate your related script files, and make sure you have already re-generated your .xml language, ewshared*.php, and ewmenu.php files.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.