Welcome, you're not connected. ( Log in - Register )

Les commandes sont pour le moment fermées jusqu'à nouvel ordre, mais je peux assurer le support.

Merci de votre compréhension.


Requests are currently closed, but I can do some support.

Thanks for your understanding.




Important links - Liens importants

Règles - Rules | Présentez-vous - Introduce yourself | Problème d'inscription ? - Registration problem ?

Ishimaru-Design > Tutorials, ressources and support > phpBB3 > Tutorials & Tips > [subsilver2] Header and Menu modification

RSS >  [subsilver2] Header and Menu modification
Ishimaru Chiaki #1 24/09/2009 - 20h18

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

We see several documentation pages related to Prosilver style, which is the one that's enabled by default in phpBB3's package.  But we see so few documentation related to subsilver2, and this results in seeing people trying, without any success, to follow documentation related to Prosilver style to modify a subsilver2-based style, for the main reason that there are much differences between subsilver2's HTML structure that uses tables, and the prosilver's HTML structure which is tableless.

One of the recurrent subject in template modification of a subsilver2-based style is the header and menu modification.  This modification will thus talk about this subject, and for this whole documentation, all modifications will be done in styles/subsilver2/template/overall_header.html file.



All  modifications have been tested on a phpBB 3.0.5 with a subsilver2 style.
Ishimaru Chiaki #2 24/09/2009 - 20h46

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

Centering the site logo

Centering the logo is one of the most requested modifications, because many people want to place the texts below the logo and use a wide banner.

To do this modification, we need to modify the header's table structure which contains two table cells that are placed side-by-side, in order to place them above each other.

Here is the initial appearance : Capture

Open your styles/subsilver2/template/overall_header.html file and find this piece of code :
   <div id="logodesc">
       <table width="100%" cellspacing="0">
       <tr>
           <td><a href="{U_INDEX}">{SITE_LOGO_IMG}</a></td>
           <td width="100%" align="center"><h1>{SITENAME}</h1><span class="gen">{SITE_DESCRIPTION}</span></td>
       </tr>
       </table>
   </div>


Just after this line :
           <td><a href="{U_INDEX}">{SITE_LOGO_IMG}</a></td>

Add this :
       </tr>
       <tr>


Let's take a look at our forum : Capture

Our site name and site description are now below the logo, but the logo isn't centered.  Let's correct this !

Still in overall_header.html, find this line :

           <td><a href="{U_INDEX}">{SITE_LOGO_IMG}</a></td>

Add this argument inside <td> tag :
align="center"

giving you this :
           <td align="center"><a href="{U_INDEX}">{SITE_LOGO_IMG}</a></td>

Let's take a look again : Capture

Our logo is now centered !

Now, if you want to remove the site name and site description (en thought I don't recommend it for page indexing), you just have to comment this piece of code :
       <tr>
           <td width="100%" align="center"><h1>{SITENAME}</h1><span class="gen">{SITE_DESCRIPTION}</span></td>
       </tr>


to get this :
       <!-- tr>
           <td width="100%" align="center"><h1>{SITENAME}</h1><span class="gen">{SITE_DESCRIPTION}</span></td>
       </tr -->


this will give you this result : Capture

Now, all is left is to replace the logo in the /imageset/ directory, then edit the imageset.cfg file to change the logo's filename and its dimensions.

But for a fixed-width banner, I recommend you to give a fixed width to your style.
Ishimaru Chiaki #3 24/09/2009 - 20h59

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

Centering the menu bar

Some phpBB users want to gather the nav links together and center them, in order to use big buttons for the nav bar.

Like for the header, the menu bar is composed of a table containing two cells, positioned side-by-side.  But this time, instead of repositioning them, we'll merge them.

For the demo, I'll continue with the file I began to modify in the previous post, so we'll have this result before the menu bar modification : Capture

In your overall_header.html file, find this piece of code :

   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed">
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_LOGIN_LOGOUT}</a>&nbsp;<!-- ENDIF -->
               <!-- IF U_RESTORE_PERMISSIONS --> &nbsp;<a href="{U_RESTORE_PERMISSIONS}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_RESTORE_PERMISSIONS}</a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> &nbsp;<span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --> &nbsp;<a href="{U_PRIVATEMSGS}"><img src="{T_THEME_PATH}/images/icon_mini_message.gif" width="12" height="13" alt="*" /> {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --> &nbsp;<a href="{U_REGISTER}"><img src="{T_THEME_PATH}/images/icon_mini_register.gif" width="12" height="13" alt="*" /> {L_REGISTER}</a>
                   <!-- ENDIF -->
               <!-- ENDIF -->
           </td>
           <td class="genmed" align="{S_CONTENT_FLOW_END}">
               <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
               <!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.gif" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.gif" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN -->&nbsp; &nbsp;<a href="{U_PROFILE}"><img src="{T_THEME_PATH}/images/icon_mini_profile.gif" width="12" height="13" alt="*" /> {L_PROFILE}</a><!-- ENDIF -->
               <!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


To merge cells, you have to find and remove these two lines :
           </td>
           <td class="genmed" align="{S_CONTENT_FLOW_END}">


Let's take a look to the result : Capture

We see that the links are now together, but the menu isn't centered.

To center it, we'll do the same thing than with the site logo, by adding align="center" inside the <td> tag that contains the links.

You find this line :
           <td class="genmed">

You add the align="center" argument to obtain this :
           <td class="genmed" align="center">

We now take a look at the final result : Capture

All is left now is to customize the banner and the menu bar style !
Ishimaru Chiaki #4 24/09/2009 - 21h52

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

Using big buttons in the menu bar

Now, with my modified overall_header.html file from the two posts above and this appearance, I'll show you how to have big buttons instead of having small icons next to each link.

The method that I'll show you will allow multilingual support for these buttons and so, your buttons language will correspond to the visitor's language choice, if your board has several languages or if you want to make a multilingual style that's destined to be downloaded freely.

While on phpBB2, we needed to do extra coding in the template's configuration file to enable multilingual support in the navbar, it's now much simpler on phpBB3 with a variable that works everywhere in the style's templates and that is as follow :

{T_IMAGESET_LANG_PATH}

This variable corresponds to the language folder of your imageset.  So, if you already have your buttons, place them in the styles/subsilver2/imageset/fr/ for French and/or styles/subsilver2/imageset/en/ for English, and you continue like this if you added other languages.  For example, I took pink Valentines buttons from one of my Forumotion styles.  Even if the look will be awful, what is important is to show the possibilities of phpBB3 styling..

Now, we're ready to modify overall_header.html to install our menu bar's big buttons !

Let's take the code of the menu that you previously centered :
   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed" align="center">
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_LOGIN_LOGOUT}</a>&nbsp;<!-- ENDIF -->
               <!-- IF U_RESTORE_PERMISSIONS --> &nbsp;<a href="{U_RESTORE_PERMISSIONS}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_RESTORE_PERMISSIONS}</a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> &nbsp;<span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --> &nbsp;<a href="{U_PRIVATEMSGS}"><img src="{T_THEME_PATH}/images/icon_mini_message.gif" width="12" height="13" alt="*" /> {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --> &nbsp;<a href="{U_REGISTER}"><img src="{T_THEME_PATH}/images/icon_mini_register.gif" width="12" height="13" alt="*" /> {L_REGISTER}</a>
                   <!-- ENDIF -->
               <!-- ENDIF -->
               <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
               <!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.gif" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.gif" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN -->&nbsp; &nbsp;<a href="{U_PROFILE}"><img src="{T_THEME_PATH}/images/icon_mini_profile.gif" width="12" height="13" alt="*" /> {L_PROFILE}</a><!-- ENDIF -->
               <!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


Now, for each link, replace all the
{T_THEME_PATH}/images

by
{{T_IMAGESET_LANG_PATH}}

Don't forget to change your pics extension if you are using PNGs for example, like I did.

This gives me this result on my side :
   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed" align="center">
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" width="12" height="13" alt="*" /> {L_LOGIN_LOGOUT}</a>&nbsp;<!-- ENDIF -->
               <!-- IF U_RESTORE_PERMISSIONS --> &nbsp;<a href="{U_RESTORE_PERMISSIONS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" width="12" height="13" alt="*" /> {L_RESTORE_PERMISSIONS}</a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> &nbsp;<span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --> &nbsp;<a href="{U_PRIVATEMSGS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message.png" width="12" height="13" alt="*" /> {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --> &nbsp;<a href="{U_REGISTER}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_register.gif" width="12" height="13" alt="*" /> {L_REGISTER}</a>
                   <!-- ENDIF -->
               <!-- ENDIF -->
               <a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" width="12" height="13" alt="*" /> {L_FAQ}</a>
               <!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_search.png" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_members.png" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN -->&nbsp; &nbsp;<a href="{U_PROFILE}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_profile.png" width="12" height="13" alt="*" /> {L_PROFILE}</a><!-- ENDIF -->
               <!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


Now, make sure that you see your buttons, and not asterisks, like in my example where you'll see pink squares corresponding to my buttons : Capture

If all your pics show up, let's go for resizing them to full size, and for placing the plain texts as alternate texts, where the stars are.  The reason is that for accessibility, if an image has to play a major role in page navigation, as it's the case for our navigation buttons, the alt="" argument must be correctly filled, so the replacement text will be displayed if the pics cannot be displayed or if a blind visitor or a visitor that uses a text browser visit the forum.  This hadn't much importance before this modification as the plain texts were present and so, there was no need to have duplicate texts, but now that we have only buttons, this detail becomes vital for your style's accessibility.

So, let's take an example in our menu :
<a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" width="12" height="13" alt="*" /> {L_FAQ}</a>

We remove the width="12" height="13" and then, we move {L_FAQ} to where the asterisk * is located in the alt="" argument, to get this result :
<a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" alt="{L_FAQ}" /></a>

Apply the same changes to each link.

Warning : About the "X new messages" link, you have to copy everything that's located between the /> and </a> of the link, so this means this piece of code :
{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF -->


Now, you should have a code that's similar to this :
   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed" align="center">
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /></a>&nbsp;<!-- ENDIF -->
               <!-- IF U_RESTORE_PERMISSIONS --> &nbsp;<a href="{U_RESTORE_PERMISSIONS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_RESTORE_PERMISSIONS}" /></a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> &nbsp;<span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --> &nbsp;<a href="{U_PRIVATEMSGS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message.png" width="12" height="13" alt="{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF -->" /></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --> &nbsp;<a href="{U_REGISTER}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_register.gif" alt="{L_REGISTER}" /></a>
                   <!-- ENDIF -->
               <!-- ENDIF -->
               <a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" alt="{L_FAQ}" /></a>
               <!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_search.png" alt="{L_SEARCH}" /></a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_members.png" alt="{L_MEMBERLIST}" /></a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN -->&nbsp; &nbsp;<a href="{U_PROFILE}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_profile.png" alt="{L_PROFILE}" /></a><!-- ENDIF -->
               <!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


Let's see the result : Capture

The buttons are now full sized, but there are spaces between them, and the "Log in" and "Log out" links have the same button.  So, let's correct these details.

We first remove the spaces (code &nbsp;), in order to stick our buttons together.
But this isn't sufficient since we have to remove some line-breaks, especially around the FAQ button where there were persistent spaces on each side.

This gives me this code :
   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed" align="center">
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /></a><!-- ENDIF -->
               <!-- IF U_RESTORE_PERMISSIONS --><a href="{U_RESTORE_PERMISSIONS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_RESTORE_PERMISSIONS}" /></a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --><span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --><a href="{U_PRIVATEMSGS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message.png" alt="{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF -->" /></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --><a href="{U_REGISTER}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_register.gif" alt="{L_REGISTER}" /></a><!-- ENDIF --><!-- ENDIF --><a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" alt="{L_FAQ}" /></a><!-- IF S_DISPLAY_SEARCH --><a href="{U_SEARCH}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_search.png" alt="{L_SEARCH}" /></a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST --><a href="{U_MEMBERLIST}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_members.png" alt="{L_MEMBERLIST}" /></a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN --><a href="{U_PROFILE}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_profile.png" alt="{L_PROFILE}" /></a><!-- ENDIF -->
               <!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


We take a look to see the graphical result, when logged in : Capture
And the same thing, when logged out : Capture
(note : in the second capture, the big space without text is the Register button which is an animated GIF with a blinking text.)

Now, let's correct the detail about the "Login/Logout" button, and I'll also show you a tip to have a different button when there are new private messages.

I begin by the "Login/Logout" button.

We take the corredponding piece of code :
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /></a><!-- ENDIF -->

Now, we need to use the conditional structure that checks if were are logged in :
<!-- IF S_USER_LOGGED_IN -->

The condition MUST be finished by a <!-- ENDIF --> comment, but we also can use <!-- ELSE --> as a complement, to display an alternate element when the condition isn't filled.  We'll use it for our button !  So, if the user is logged in, the button "Log out" will show up, and if not, the "Log in" button will show up.

And just a small note for those who were used to phpBB2 : Take note that on phpBB3, you can now insert these comments in a "inline" way and so, you don't need to place these comments in separate lines, unlike phpBB2 where you get your navbar cut off if you don't do this !

We'll now apply this to our "Log in/Log out" button :
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><!-- IF S_USER_LOGGED_IN --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_logout.png" alt="{L_LOGIN_LOGOUT}" /><!-- ELSE --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /><!-- ENDIF --></a><!-- ENDIF -->

Let's see the result, after loggin-in : Capture

Now, the Logout button shows up !

Now, let's go for the bonus tip : Some users want to use a different button when the user has new private messages.

So, let's take the corresponding code piece :
                       <!-- IF S_DISPLAY_PM --><a href="{U_PRIVATEMSGS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message.png" alt="{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF -->" /></a><!-- ENDIF -->

In this code, we'll use the <!-- IF S_USER_NEW_PRIVMSG --> switch, with a <!-- ELSE --> to display a different button.

Let's apply it :
                       <!-- IF S_DISPLAY_PM --><a href="{U_PRIVATEMSGS}"><img src="<!-- IF S_USER_NEW_PRIVMSG -->{T_IMAGESET_LANG_PATH}/icon_mini_message_new.gif<!-- ELSE -->{T_IMAGESET_LANG_PATH}/icon_mini_message.png<!-- ENDIF -->" alt="{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF -->" /></a><!-- ENDIF -->

Let's now view the result.  By chance, on the test board I use for the screenshots, one of the test accounts has one unread private message, so I just have to log into this account to see the result : Capture

You don't see the text in my capture since it's an animated GIF with a blinking text, and this corresponds to my "New private messages" button !


Now, you can also modify the buttons positioning, like for example moving "Log in/Log out" at the right end instead of the left end !
So, for this example, I move this block :
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><!-- IF S_USER_LOGGED_IN --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_logout.png" alt="{L_LOGIN_LOGOUT}" /><!-- ELSE --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /><!-- ENDIF --></a><!-- ENDIF -->

to place it just before :
           </td>
       </tr>
       </table>
   </div>


Now, here's the final code :
   <div id="menubar">
       <table width="100%" cellspacing="0">
       <tr>
           <td class="genmed" align="center">
               <!-- IF U_RESTORE_PERMISSIONS --><a href="{U_RESTORE_PERMISSIONS}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_RESTORE_PERMISSIONS}" /></a><!-- ENDIF -->
               <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --><span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_USER_LOGGED_IN -->
                       <!-- IF S_DISPLAY_PM --><a href="{U_PRIVATEMSGS}"><!-- IF PRIVATE_MESSAGE_INFO_UNREAD --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message_new.gif" alt="{PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD}" /><!-- ELSE --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_message.png" alt="{PRIVATE_MESSAGE_INFO}" /><!-- ENDIF --></a><!-- ENDIF -->
                   <!-- ELSEIF S_REGISTER_ENABLED --><a href="{U_REGISTER}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_register.gif" alt="{L_REGISTER}" /></a><!-- ENDIF --><!-- ENDIF --><a href="{U_FAQ}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_faq.png" alt="{L_FAQ}" /></a><!-- IF S_DISPLAY_SEARCH --><a href="{U_SEARCH}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_search.png" alt="{L_SEARCH}" /></a><!-- ENDIF -->
               <!-- IF not S_IS_BOT -->
                   <!-- IF S_DISPLAY_MEMBERLIST --><a href="{U_MEMBERLIST}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_members.png" alt="{L_MEMBERLIST}" /></a><!-- ENDIF -->
                   <!-- IF S_USER_LOGGED_IN --><a href="{U_PROFILE}"><img src="{T_IMAGESET_LANG_PATH}/icon_mini_profile.png" alt="{L_PROFILE}" /></a><!-- ENDIF -->
               <!-- ENDIF -->
               <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><!-- IF S_USER_LOGGED_IN --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_logout.png" alt="{L_LOGIN_LOGOUT}" /><!-- ELSE --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_login.png" alt="{L_LOGIN_LOGOUT}" /><!-- ENDIF --></a><!-- ENDIF -->
           </td>
       </tr>
       </table>
   </div>


And the final visual result of our menu bar : Capture

Now, you have your navbar with big buttons !
Edited by Ishimaru Chiaki on 27/09/2011 at 19h35.
patuan89 #5 20/12/2010 - 10h13

Class : ID Newbie
Posts : 3
Registered on : 20/12/2010

Offline

very useful tips, thank you so much for sharing


esperenza #6 24/09/2011 - 21h18

Class : ID Newbie
Posts : 4
Registered on : 24/09/2011

Offline

Great tutorial. I have one problem regarding the new message button. It only appears after I go into my inbox or else I won't know there's a new message.

Here's the screenshot:

Main forum when there's a new message:
Posted Image



The "new message" button only appears when I go into inbox:
Posted Image

Below is my overall_header.html. FYI, I didn't change "{T_THEME_PATH}/images" to "{{T_IMAGESET_LANG_PATH}}" because I don't feel I have to. Hope that's not the cause of the error.

Hope you can help me with this issue. Thanks.

    <div id="menubar">
        <table width="100%" cellspacing="0">
        <tr>
            <td class="genmed" align="center">
                <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><!-- IF S_USER_LOGGED_IN --><img src="{T_IMAGESET_LANG_PATH}/icon_mini_logout.png" alt="{L_LOGIN_LOGOUT}" /><!-- ELSE --><img src="{T_THEME_PATH}/images/icon_mini_login.png"  alt="{L_LOGIN_LOGOUT}" /><!-- ENDIF --></a><!-- ENDIF -->
                <!-- IF U_RESTORE_PERMISSIONS --><a href="{U_RESTORE_PERMISSIONS}"><img src="{T_THEME_PATH}/images/icon_mini_login.png"  alt="{L_RESTORE_PERMISSIONS}" /> </a><!-- ENDIF -->
                <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --><span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF -->
                <!-- IF not S_IS_BOT -->
                    <!-- IF S_USER_LOGGED_IN -->
                        <!-- IF S_DISPLAY_PM --><a href="{U_PRIVATEMSGS}"><!-- IF PRIVATE_MESSAGE_INFO_UNREAD --><img src="{T_THEME_PATH}/images/icon_mini_message_new.gif" alt="{PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD}" /><!-- ELSE --><img src="{T_THEME_PATH}/images/icon_mini_message.png" alt="{PRIVATE_MESSAGE_INFO}" /><!-- ENDIF --></a><!-- ENDIF -->
                    <!-- ELSEIF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --><a href="{U_REGISTER}"><img src="{T_THEME_PATH}/images/icon_mini_register.png"  alt="{L_REGISTER}" /> </a>
                    <!-- ENDIF -->
                <!-- ENDIF -->
           
                <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.png"  alt="{L_FAQ}" /> </a>
                <!-- IF S_DISPLAY_SEARCH --><a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.png"  alt="{L_SEARCH}" /> </a><!-- ENDIF -->
                <!-- IF not S_IS_BOT -->
                    <!-- IF S_DISPLAY_MEMBERLIST --><a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.png"  alt="{L_MEMBERLIST}" /> </a><!-- ENDIF -->
                    <!-- IF S_DISPLAY_TOPLIST --><a href="{U_REPUT_TOPLIST}"><img src="{T_THEME_PATH}/images/icon_mini_toplist.png"  alt="{L_REPUT_TOPLIST}" /></a><!-- ENDIF -->
                <!-- IF S_DISPLAY_THANKSLIST --><a href="{U_THANKSLIST}"><img src="{T_THEME_PATH}/images/icon_mini_thanks.png"  alt="{L_GRATITUDES}" /> </a><!-- ENDIF -->
                    <!-- IF S_USER_LOGGED_IN --><a href="{U_PROFILE}"><img src="{T_THEME_PATH}/images/icon_mini_profile.png"  alt="{L_PROFILE}" /> </a><!-- ENDIF -->
                <!-- ENDIF -->
            </td>
        </tr>
        </table>
    </div>
Ishimaru Chiaki #7 26/09/2011 - 01h39

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

Hello,

I'll do some tests on my local phpBB3 forum to see if I can reproduce the issue.

I don't think the fact of using {T_THEME_PATH} instead of {T_IMAGESET_LANG_PATH} is the cause, but if you want your board's interface to be available in more than one language (ex: English and French), the stated variable allows to make your buttons localizable by using the localized imageset folders instead of the theme images folders.
esperenza #8 26/09/2011 - 20h06

Class : ID Newbie
Posts : 4
Registered on : 24/09/2011

Offline

Since my board is only in English, I don't think I need to localize the buttons.

Anyway, thanks for the help and hopefully, you can solve this problem for me.
Ishimaru Chiaki #9 26/09/2011 - 22h52

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

Hello,

I tested with your code (except for the two extra links that I removed) on my local board, and I used my two browsers (Firefox and Chromium) to send PMs between the two accounts and I encountered this bug.  I then tested with my own code and I have the same result.

When I first tested this modification a few versions ago, I didn't have this bug.  I wonder if this couldn't come from a phpBB update.  I will ask on phpbb.com, and if needed, I'll open a ticket on the bug tracker.

[EDIT] Posted on phpbb.com : http://www.phpbb.com/community/viewtopic.php?f=74&t=2140792
Edited by Ishimaru Chiaki on 26/09/2011 at 23h21.
esperenza #10 27/09/2011 - 08h20

Class : ID Newbie
Posts : 4
Registered on : 24/09/2011

Offline

Hi there, I have corrected the error based on phpbb's recommendation and it works! Thanks once again for your help.
Ishimaru Chiaki #11 27/09/2011 - 19h43

Class : ID Admin
Posts : 1437
Registered on : 12/11/2007
Age : 28
Sex : Female

Offline Mail Www

And thanks to you as well.  Without your post, I wouldn't have discovered this bug in my modification.

 >  Fast reply

Message

Ishimaru-Design > Tutorials, ressources and support > phpBB3 > Tutorials & Tips > [subsilver2] Header and Menu modification

 >  Stats

1 user(s) connected during the last 10 minutes (0 member(s) and 1 guest(s)).