Open custom link in a new window. Open custom link in a new window.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Open custom link in a new window.

Started by MetalHellsAngel, December 04, 2005, 07:29:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MetalHellsAngel

How could I make my custom link open in a new window?

t.y.i.a.
Angel

Paver

Since the devs were careful to avoid code-injection in the Config option, you cannot do it there.

The best thing to do is to create your own theme and modify it to your tastes.  Make a copy of whatever theme you are currently using and start modifying.  (For example, I made a folder "classic-mod".)  You'll be overriding the default sub_menu in theme.php.  If you are using a theme other than "Classic", you might have this already.  If you see a bunch of HTML for the sub_menu, look for <a href="{CUSTOM_LNK_TGT}" and modify this to <a href="{CUSTOM_LNK_TGT}" target="_blank"
If your theme overrides the sub_menu by using addbutton, look for     addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
and modify this to     addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}" target="_blank','custom_link',$template_sub_menu_spacer);
This is actually an example of code-injection but since you are the admin modifying your own theme.php, I think it's OK.  To avoid code-injection completely (which might be necessary in the future), you'd have to rewrite your sub_menu as all HTML and then do what I said above for the HTML case.

If you are using "Classic", you'll have to copy code from the "sample" theme to override the sub_menu and then do what I said above for the addbutton case.  Copy the code from the line // Creates buttons from a template using an array of tokens
to the line just before // HTML template for gallery admin menu (don't include this last line).  Then comment out the following 4 lines (by putting two slashes at the beginning of each line):   // $params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  // $template_sys_menu = template_eval($template_sys_menu,$params);
and
  // $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  // $template_sub_menu = template_eval($template_sub_menu,$params);


This overrides both the system_menu and the sub_menu and you can modify at will.