Adding navigational links to your MOD (breadcrumbs)

Posted by battye in Modifications with the tags , , on January 31st, 2010

An easy way to add navigational links to your MOD is to use an inbuilt feature of phpBB3 called “breadcrumbs” (named because it leaves a trail back to the forum index).

It only requires a few extra lines of PHP code to add a breadcrumb to your own MOD (or to your website if you are doing personal customisations). This article explains how to do so.

To understand how this works, open styles/prosilver/template/overall_header.html and find this code:

Code: Select all
<!-- BEGIN navlinks --> <strong>‹</strong> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks -->

This section of templating code is responsible for the creation of the breadcrumbs your see at the top of your forum.


As you can see from the code, “{navlinks.U_VIEW_FORUM}” is the actual web address of the page and “{navlinks.FORUM_NAME}” is the name of the page you are linking to.

To add a breadcrumb of your own in your MOD, open the main .php file for your MOD. Then find the page_header function call in your script (you may have several of these, so you can do this to some or all of them if you wish).

Before the page_header call, add this code:

Code: Select all
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $user->lang['MOD_INDEX'],
'U_VIEW_FORUM' => append_sid('my_mod.'.$phpEx),

As you can see, this templating code corresponds to the “navlinks” loop shown above in overall_header.html

It would give an output like this:


$user->lang[‘MOD_INDEX’] is only an example language variable, you can set this to any language variable you like (or if it is for personal use and not a MOD, a hard coded string). In the append_sid call, you also need to replace “my_mod” with whatever the name of your .php page is called. If for whatever reason you wanted to link off-site, you could do this also by hard-coding a string. (ie. ‘U_VIEW_FORUM’ => ‘’,)

Another feature of the breadcrumbs is that as it is using a template loop, you can include the code repeatedly to get more links. You could also include the code inside a loop to good effect (a foreach loop would be very useful).

For instance, you could use this code:

Code: Select all
$navlinks_array = array(
'FORUM_NAME' => $user->lang['MOD_INDEX'],
'U_VIEW_FORUM' => append_sid('my_mod.'.$phpEx),

'FORUM_NAME' => $user->lang['MOD_SUBPAGE'],
'U_VIEW_FORUM' => append_sid('my_mod.'.$phpEx, 's=1'),

'FORUM_NAME' => $user->lang['MOD_SUBPAGE_2'],
'U_VIEW_FORUM' => append_sid('my_mod.'.$phpEx, 's=2'),

foreach( $navlinks_array as $name )
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $name['FORUM_NAME'],
'U_VIEW_FORUM' => $name['U_VIEW_FORUM'],

To generate an output like this:


As these examples only require PHP changes and no template changes, there is no need to purge the cache once the changes have been applied.

I hope this article has been useful.

17 Responses to “Adding navigational links to your MOD (breadcrumbs)”

Posted by Kamran on January 31st, 2010 at 4:41 am:

I actually was looking for something like this, Great that I can finally add it ๐Ÿ™‚
Thank you for posting it.

Posted by Senky on January 31st, 2010 at 9:50 am:

Waw, finally, I know how to do this… Okay, so lets update MODs ๐Ÿ™‚

Posted by Dog Cow on February 1st, 2010 at 6:45 pm:

I didn’t realize that there was a function for this. ๐Ÿ™‚

Posted by David on February 2nd, 2010 at 4:01 am:

Now if only there were a way to easily add links next to the FAQ and Members links, using PHP to remove the need for template edits in overall header. ๐Ÿ˜€

But thanks for the good tutorial. ๐Ÿ™‚

Posted by whmcs templates on February 2nd, 2010 at 7:20 am:

Just discovered your blog and IT ROCKS! I absolutely love your style – it’s very authentic.

Posted by Martin Truckenbrodt on February 3rd, 2010 at 9:35 pm:

the easiest and most usefull way to do a lot of things is just to try to understand how phpBB3 code is working and then to copy&paste&customize it for the MOD. Learning by doing! ๐Ÿ˜‰
Bye Martin

Posted by Max on February 4th, 2010 at 5:11 am:


Thats nice ..I have been searching it around ..this will help me fix few things at my end.

Thank you members.

Posted by Sajaki on February 6th, 2010 at 9:28 am:

overall_header.html changes are the biggest source of mod conflicts, so if it is possible to avoid editing it through MODX, this is great news ๐Ÿ˜‰

Posted by Sajaki on February 6th, 2010 at 4:13 pm:

would this also work on Subsilver2 ?

Posted by Nathan on February 16th, 2010 at 1:34 pm:

Great tutorial.

@ Sajaki, I don’t think it would work with Subsilver2, the edits would be different I think. But then again it’d be stupid for them to post a tutorial only for prosilver.

Good luck though.

Posted by updown on February 24th, 2010 at 12:43 am:

@Sajakim @Nathan:
This is style-independant, so of course it also works with subsilver2 as with any other phpbb-style.

Posted by raj on March 15th, 2010 at 8:04 am:

Hello ,

Posted by Eric on March 16th, 2010 at 1:22 am:

I know this sounds dumb but I have no clue where to edit any of the text within my new forum. Such as in the header where it says Where do you do this at I have searched for hours.

Thanks for any help

Posted by Pete Smith on March 17th, 2010 at 1:08 am:


The site name can be changed in ACP (Administration Control Panel) ยป Board settings (left menu) ยป Site name

Don’t post support requests on the blog, use the support forum created for this purpose.

Posted by Graham on May 5th, 2010 at 4:08 pm:

Thanks for this, any information that is easy to understand, such as this, is always welcome.

Posted by xseoer on July 14th, 2010 at 1:43 am:

This is what i am looking for.

Posted by Steve on August 12th, 2010 at 10:11 pm:

Are using breadcrumbs still as effective as they used to be when it comes to seo?

Commenting is disabled for this blog post