adding rel="nofollow" to Gavick menu item

Feel free to talk about everything related to our Joomla Products
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Fri Jul 20, 2012 7:31 pm
Hi,

In most of the gavick template the main menu is not a module and set through the template. I need to add rel="nofollow" to some of the items on my main menu. I was able to modify the menu module on joomla to achieve this but since the Gavick template overwrite the code for the main menu i can't get this to work. Basically what i did was to modify the code on modules/mod_menu/tmpl/default_url.php
Code: Select all
$class = $item->anchor_css ? 'class="'.$item->anchor_css.'" ' : '';

To
Code: Select all
$class = $item->anchor_css ? 'rel="'.$item->anchor_css.'" ' : '';


Now when i add nofollow on "Link CSS Style" on backend it works fine. but it doesn't show the change on the main menu on my Gavick template. I'm using joomla 1.7 (soon to be 2.5) and Black&White template. Is there anyway to make this work on the main menu item?
User avatar
Junior Boarder

GK User
Fri Jul 20, 2012 8:02 pm
Hi,

Please look into this file: \templates\gk_esport\lib\menu\GKBase.class.php

And try adding the rel value to:
Code: Select all
 if ($tmpname) {
                if ($tmp->type == 'separator') {
                    $data = '<a href="#" ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                } else {
                    if ($tmp->url != null) {
                        switch ($tmp->browserNav) {
                            default:
                            case 0:
                                // _top
                                $data = '<a href="' . $tmp->url . '" ' . $active . ' ' . $id . ' ' . $title .
                                    '>' . $txt . '</a>';
                                break;
                            case 1:
                                // _blank
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                            case 2:
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                        }
                    } else {
                        $data = '<a ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                    }
                }
            }
User avatar
Platinum Boarder

GK User
Fri Jul 20, 2012 8:28 pm
Don Lee wrote:Hi,

Please look into this file: \templates\gk_esport\lib\menu\GKBase.class.php

And try adding the rel value to:
Code: Select all
 if ($tmpname) {
                if ($tmp->type == 'separator') {
                    $data = '<a href="#" ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                } else {
                    if ($tmp->url != null) {
                        switch ($tmp->browserNav) {
                            default:
                            case 0:
                                // _top
                                $data = '<a href="' . $tmp->url . '" ' . $active . ' ' . $id . ' ' . $title .
                                    '>' . $txt . '</a>';
                                break;
                            case 1:
                                // _blank
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                            case 2:
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                        }
                    } else {
                        $data = '<a ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                    }
                }
            }

he Done thank for your reply. I can't figure out exactly how to make this work. If i add the nofollow tag would it add be applied to all the menu items on the menu? how can i decide which menu item gets the tag and which one won't.
User avatar
Junior Boarder

GK User
Fri Jul 20, 2012 8:43 pm
If you customize that code, all the menu items will get affected, if you want to have an option to select items to add the tag it would require a lot of customization.
User avatar
Platinum Boarder

GK User
Fri Jul 20, 2012 9:29 pm
Don Lee wrote:If you customize that code, all the menu items will get affected, if you want to have an option to select items to add the tag it would require a lot of customization.


Yes, i figured. Gavick really needs to create the main menu on a module position. This is not the first time I have issue with customizing the menu. I don't know if you guys do this on the new templates or not. Anyways, thanks for your help :)
User avatar
Junior Boarder

GK User
Sat Jul 21, 2012 7:03 pm
Yes, I will check what our developers think about that as I think it's a good idea as well.

Cheers,
User avatar
Platinum Boarder

GK User
Sun Jul 22, 2012 3:58 am
Quick mod for you, tested on esport template.

Adds nofollow switch to menu items, switch it on/off from menu item settings under Menu Params (GavickPro).

Image

Find File: /plugins/system/plg_gkextmenu/parameters.xml
Find Lines: 42/43/44 which is below
Code: Select all
               <option value="menu9">menu9</option>
               <option value="menu10">menu10</option>
            </field>

Replace with below.
Code: Select all
               <option value="menu9">menu9</option>
               <option value="menu10">menu10</option>
            </field>
            <field name="gk_rel" type="radio" default="0" label="Enable No Follow:" description="Enable or disable nofollow option for this menu item.">
               <option value="0">No</option>
               <option value="1">Yes</option>
            </field>


Find File: /templates/gk_esport/lib/menu/GKBase.class.php
Find Lines: 372 to 398 which is below
Code: Select all
            if ($tmpname) {
                if ($tmp->type == 'separator') {
                    $data = '<a href="#" ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                } else {
                    if ($tmp->url != null) {
                        switch ($tmp->browserNav) {
                            default:
                            case 0:
                                // _top
                                $data = '<a href="' . $tmp->url . '" ' . $active . ' ' . $id . ' ' . $title .
                                    '>' . $txt . '</a>';
                                break;
                            case 1:
                                // _blank
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                            case 2:
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . '>' . $txt . '</a>';
                                break;
                        }
                    } else {
                        $data = '<a ' . $active . ' ' . $id . ' ' . $title . '>' . $txt . '</a>';
                    }
                }
            }

Replace with below
Code: Select all
            if ($tmp->gkparams->get('gk_rel')) {
                $rel = " rel=\"nofollow\"";
            }
            if ($tmpname) {
                if ($tmp->type == 'separator') {
                    $data = '<a href="#" ' . $active . ' ' . $id . ' ' . $title . ' ' . $rel . '>' . $txt . '</a>';
                } else {
                    if ($tmp->url != null) {
                        switch ($tmp->browserNav) {
                            default:
                            case 0:
                                // _top
                                $data = '<a href="' . $tmp->url . '" ' . $active . ' ' . $id . ' ' . $title .
                                    ' ' . $rel . '>' . $txt . '</a>';
                                break;
                            case 1:
                                // _blank
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . ' ' . $rel . '>' . $txt . '</a>';
                                break;
                            case 2:
                                $data = '<a href="' . $tmp->url . '" target="_blank" ' . $active . ' ' . $id .
                                    ' ' . $title . ' ' . $rel . '>' . $txt . '</a>';
                                break;
                        }
                    } else {
                        $data = '<a ' . $active . ' ' . $id . ' ' . $title . ' ' . $rel . '>' . $txt . '</a>';
                    }
                }
            }


See you around...
User avatar
Platinum Boarder

GK User
Mon Jul 23, 2012 6:44 am
Really brilliant, thank you very much for the trick mate!
User avatar
Platinum Boarder

GK User
Tue Jul 24, 2012 4:18 pm
No problem at all, see you around ;)
User avatar
Platinum Boarder

GK User
Wed Jul 25, 2012 5:51 pm
Norman you are awesome! It worked great!
User avatar
Junior Boarder

GK User
Wed Jul 25, 2012 10:11 pm
No problem at all, this will be implemented possibly on next template updates.

See you around...
User avatar
Platinum Boarder

GK User
Sun Aug 17, 2014 9:26 pm
Hello there,

still no correction directly on the plug-in?

it does not work with Joomla 3.3.3.

thank you in advance.
User avatar
Junior Boarder


cron