Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial]How to edit / add new top links in MyBB[Tutorial]
#1
This user has been denied support. This user has been denied support.
What's a top link? You may be asking, well it's the links that are at the top of your forum, usually to the right hand side.

[Image: rm0478.jpg]

There's two ways to do this, an easy and a less easy way. I'm going to show you both.


The less easy, but proper way.

1. Editing the language file.

Browse to and open:


Code:
/inc/languages/english/global.lang.php

The section you're looking for should be at the top, and look similar, if not the same as:

[Image: 33wm5wm.jpg]

2. In here, just add the top links that you wish to add then save the file, like so:

[Image: vqr80g.jpg]

3. Upload the images you wish to use to your theme's toplink image folder.

Code:
/images/themename/toplinks/


4. Editing the header template of your theme

On your forum, go to.


Code:
Admin control panel (ACP) > Themes and Templates > Templates > Your Template name > Options > Expand > Header Templates > Options > Expand > header

PHP Code:
<div id="container">
        <
a name="top" id="top"></a>
        <
div id="header">
            <
div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}alt="{$mybb->settings['bbname']}title="{$mybb->settings['bbname']}/></a></div>
            <
div class="menu">
                <
ul>
 
                                        <
li><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/home.gif" alt="" title="Home" />{$lang->toplinks_home}</a></li>       
                                        <
li><a href="{$mybb->settings['bburl']}/donate.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/search.gif" alt="" title="Donate" />{$lang->toplinks_donate}</a></li>
                    <
li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="Member List" />{$lang->toplinks_memberlist}</a></li>
                    <
li><a href="{$mybb->settings['bburl']}/member.php?action=emailuser&uid=1"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/calendar.gif" alt="" title="Contact" />{$lang->toplinks_contact}</a></li>
                                        <
li><a href="http://twitter.com/mcomputeforums" target="_blank"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/twitter.gif" alt="" title="Twitter" />{$lang->toplinks_twitter}</a></li>                                     
                    <
li><a href="{$mybb->settings['bburl']}/misc.php?action=help&hid=8"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/help.gif" alt="" title="Rules" />{$lang->toplinks_rules}</a></li>
                </
ul>
            </
div

These are your top links:

Quote:<li ><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/home.gif" alt="" title="Home" />{$lang->toplinks_home}</a ></li >

If you want to do an external link, it's like so:

Quote:<li ><a href="http://twitter.com/mcomputeforums" target="_blank"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/twitter.gif" alt="" title="Twitter" />{$lang->toplinks_twitter}</a ></li >

Just add your links in as desired, remember to add the right image name etc.

The easier way

On your top links, eg:
Quote:<li ><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/home.gif" alt="" title="Home" />{$lang->toplinks_home}</a ></li >

Quote:<li ><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/home.gif" alt="" title="Home" />Home {$lang->toplinks_home}</a ></li >

Credit:-Mark
<snip>
Reply
#2
thanks for special tuto Big Grin
Reply
#3
This is a great tutorial, but I don't see a point in adding these to the language file.
Reply
#4
I don't want the image, so what would I change?

EDIT: nvm got it but nice tutorial
Reply
#5
For example if you have something like this:

Code:
<li ><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/home.gif" alt="" title="Home" />Home {$lang->toplinks_home}</a ></li >

You just have to delete image part:
Code:
<li ><a href="{$mybb->settings['bburl']}/index.php"> Home {$lang->toplinks_home}</a ></li >
Jovan J.
Reply
#6
Thanks for the tutorial.
Question though -
Can you elaborate on how to remove the toplink images... where do I edit that code? Do I need to edit it in multiple files? I know just deleting the toplink image folder will get rid of them, but I want to delete the code associated with them too.

Thanks for the help-
Reply
#7
(10-03-2012, 04:10 PM)A N K E S H Wrote: 4. Editing the header template of your theme

On your forum, go to.


Code:
Admin control panel (ACP) > Themes and Templates > Templates > Your Template name > Options > Expand > Header Templates > Options > Expand > header

@ebineesey, you have to edit code in above referred header template.
Reply
#8
(04-11-2013, 06:38 AM).m. Wrote:
(10-03-2012, 04:10 PM)A N K E S H Wrote: 4. Editing the header template of your theme

On your forum, go to.


Code:
Admin control panel (ACP) > Themes and Templates > Templates > Your Template name > Options > Expand > Header Templates > Options > Expand > header

@ebineesey, you have to edit code in above referred header template.

Thank you!
Great help; guess I missed that small detail! Toungue
Reply
#9
I prefer the "easier" method of adding the text to the template rather than modifying the global_lang.php. The rason I say that is because when it comes time to do an upgrade, you don't lose your work when the global_lang file is replaced during the upgrade. You changes are saved when you export your themes and include the templates.
Reply
#10
But how are links added to these new header text and images?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)