0

I am using a SJ Flat menu module and some of my menu items have the Target windows set to New window with navigation.

Unfortunately, the module removed that attribute and it has a new declaration of the Target behavior.

Below is the code

    $target = "";
                    $link_target = $params->get('link_target','_self');
                    switch($link_target){
                        default:
                        case '_self':
                            break;
                        case '_blank':
                        case '_parent':
                        case '_top':
                            $target = 'target="'.$link_target.'"';
                            break;
                        case '_windowopen':
                            $target = "onclick=\"window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,false');return false;\"";
                            break;
                        case '_modal':
                            // user process
                            break;
                    }
                    $icon_menu = ($menus[$i]->menu_image != '')?'<img src='.JURI::base().$menus[$i]->menu_image.' alt='.$menus[$i]->title.'  title='.$menus[$i]->title.' />':'';
                    $divLink = "<div class='fm-link' ".$style."><a ".$target." href='".$menus[$i]->flink."'>".$icon_menu.$menus[$i]->title."</a>
</div>";

Now I want to use the module but will have the natural way of linking.

The situation right now is, I set Target Window to New Window With Navigation in the menu item, see below screencapTarget Window

But the problem is, the target window is being cleared in the module because the module that I am using has a target window setting also. But if you set the target window in the module it will affect all the menu item.

Module Target window setting

So after checking the codes of the module, i found the above code.

Now I want to disregard the setting in the module and inherit the setting from the menu item

  • What does natural way of linking mean - target="_blank"? Or do you know the value? – iamrobert Feb 9 '17 at 17:21
  • I want that whatever is set from the target window from the menu item will be the behavior of the link. The situation right now is, if i set a target from the menu item, it will be removed in the module because the module has an option also to set link target – kulot Feb 10 '17 at 5:56
0

Target Window to New Window With Navigation = target="_blank"

If you look at:

modules > mod_menu > tmpl > default_url.php

you will find the default Joomla style which is:

   if ($item->browserNav == 1)
    {
        $attributes['target'] = '_blank';
    }
    elseif ($item->browserNav == 2)
    {
        $options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,' . $params->get('window_open');

        $attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";
    }

Alternatively - the template that you have may have the it located in the following folder:

templates > templatename > html > modules > mod_menu > tmpl > default_url.php

So - looking at these may give you a clue into how to solve it.

  • Saw that file and i was trying ti find the right variable, that's where the point i decided to post the problem here – kulot Feb 11 '17 at 16:35
  • Are you trying to get a different link for each menu item? Sometimes same window, sometimes new window. Then you would be better off do a menu override. – iamrobert Feb 12 '17 at 15:49
  • Yes, that's exactly what I am trying to achieve. Can you guide me on how to do that? – kulot Feb 13 '17 at 5:53
  • Ok - I added a new answer above - it requires a good knowledge of php/html/css and custom templating. – iamrobert Feb 14 '17 at 7:10
  • Thanks for the guide, the good thing is we managed to edit the module files so that it will have the default link behavior – kulot Feb 15 '17 at 8:30
0

You want to override the menu and give it a unique style for the module position.

A background primer for overrides would be here: https://docs.joomla.org/Understanding_Output_Overrides https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core https://docs.joomla.org/Layout_Overrides_in_Joomla

So in your template you would create in your html/mod_menu folder - a structure similar to:

https://github.com/thetemplateblog/JoomberUI/tree/master/html/mod_menu

  1. Create a new php file that you want to apply the style to: eg: sflat.php
  2. Apply the html/php - similar to joomberUI - however with the classes from sflat - as you haven't provided what the final output should be - I can't help you with this.
  3. Setup the module, and apply the style sflat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.