Results 1 to 3 of 3

Thread: have menu link open new window

  1. #1
    MightyMouse's Avatar
    MightyMouse is offline Junior Member
    Join Date
    Jun 2008
    Posts
    3

    Default have menu link open new window

    I have added a link to my menu using MyPortal. The problem is that I don't want it to open in a frame I want it to open in a new window. Can anyone tell me how this can be done?

  2. #2
    MightyMouse's Avatar
    MightyMouse is offline Junior Member
    Join Date
    Jun 2008
    Posts
    3

    Default Re: have menu link open new window

    This seems like it should be so simple, but I have been stuck on it for a while. I've tried searching the forums, but I can't find anything that works or makes much sense to me. Has anyone run into this problem, there must be a solution!

  3. #3
    eescribano's Avatar
    eescribano is offline Senior Member
    Join Date
    Mar 2009
    Location
    Netherlands
    Posts
    85

    Default Re: have menu link open new window

    It doesn't seem that you can do this without a corehack in the module IFrames... but I would modify first the theme and add by hand the tab with your link than touch anything in the module IFrames...

    You can modify the header in themes/<ThemeName>/header.php and also themes/<ThemeName>/header.html

    I have modify the theme Sugar adding a param TARGET that I take in header.html where the menu is located.
    In my case is in the line 574 where starts the code
    PHP Code:
        foreach ($moreListHeader as $module_name) {
            if (!
    is_array($module_name)) {
                if(
    $module_name!=$currentModule and $_SESSION['moreTab']!=$module_name){
                    
    $xtpl->assign("MODULE_NAME"$app_list_strings['moduleList'][$module_name]);
                    
    $xtpl->assign("MODULE_KEY"$module_name);
                    
    $xtpl->assign("TARGET""");
                    
    $xtpl->assign("TAB_URL""index.php?module=$module_name&action=index");
                    
    $xtpl->parse("main.more");
                }
            } else {
                if (!isset(
    $_REQUEST['record']) or $_REQUEST['record']!=$module_name[0]) {
                    
    $xtpl->assign("MODULE_NAME"$module_name[4]);
                    
    $xtpl->assign("MODULE_KEY"$module_name[3]);
                    
    $xtpl->assign("TARGET""_blank"); //This is the new line I added with the target
                    
    $xtpl->assign("TAB_URL""{$module_name[1]}");//This line I changed it so it takes only the url of the website I want, it has to have the http://
                    
    $xtpl->assign("MODULE_QUERY"'&record='.$module_name[0].'&tab='.$module_name[2]);
                    
    $xtpl->parse("main.more");
                }

            }

        } 
    And in header.html I added a the property target here:
    It starts in line 150 because My link is in the "MoreMenu", but if the tab is going to be in other place then you will have to find the correct place to put the target.

    PHP Code:
    <div id="MoreMenu" class="menu" onMouseOver="window.clearTimeout(SUGAR.themes.resetSubTabsTimer);" onMouseOut="SUGAR.themes.setResetTimer();">
        <!-- 
    BEGINmore -->
        <
    a href="{TAB_URL}" class="menuItem" id="{MODULE_KEY}Handle" parentid="MoreMenu" 
    target="{TARGET}" //added property target
    onMouseOver="hiliteItem(this,'yes');SUGAR.themes.updateSubTabsDelay(SUGAR.themes.moreTab,'{{MODULE_NAME|htmlspecialchars}','{MODULE_NAME|htmlspecialchars}');closeSubMenus(this);" onMouseOut="unhiliteItem(this);" onClick="SUGAR.themes.chooseTab('{MODULE_NAME}'); return true;">{MODULE_NAME}</a>
        <!-- 
    ENDmore -->
        </
    div
    Like this it opens for me the link in a target=_blank

    But this example works for ALL links you add with MyPortal... you can add ifs to check if it is the one you want in _blank target... and of course this is not upgrade safe...

    Hope this can help
    Elisabeth Escribano
    Webdeveloper

    MADCAP verademing in ict

    e.escribano@madcap.nl

    Schapedrift 89
    3371 JJ Hardinxveld-Giessendam
    Netherlands
    Tel 088 99 088 99
    Fax 088 99 088 98

    www.madcap.nl

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open hyperlink in a new window
    By bathi741 in forum Developer Help
    Replies: 1
    Last Post: 2009-02-11, 10:27 PM
  2. Replies: 1
    Last Post: 2008-12-05, 06:36 AM
  3. Usability: Open Selected or Open All in new tab/window
    By andydreisch in forum Feature Requests
    Replies: 0
    Last Post: 2007-08-31, 06:29 PM
  4. Open Calendar Task in New Window or Tab
    By JeanetteRoss in forum Help
    Replies: 1
    Last Post: 2007-07-06, 10:42 AM
  5. popup window will not open
    By joealiferis in forum Help
    Replies: 3
    Last Post: 2006-02-06, 08:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •