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 contains the external links and 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 the menu item, 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, until PHPMaker version 9.0.1 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.
Updated on May 30, 2012: This customization has been implemented in PHPMaker version 9.0.2, it matches to each other, and as a result, it works properly.
Updated on July 22, 2012: This customization has been implemented in PHPMaker version 9.0.3, it matches to each other, and as a result, it works properly.
Updated on September 5, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 28, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 9, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: The customization has been handled by using MasinoFixedWidthSite extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
[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 from PHPMaker application. Create your own new menu items, 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 using PHPMaker as always.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.