SMF Online Manual

*
  • Home
  • Community
  • Download
  • Customize
    • Modifications
    • Themes
    • Upgrades
  • Support
    • Function Database
  • Online Manual
  • About
  • Contribute
  • Development
 

Documentation of the moment:

Now announcing the SMF wiki (beta)


  • Home
  • Help
  • Search
  • Login
  • Register

  • SMF Online Manual »
  • Glossary »
  • FAQs »
  • Theme Questions »
  • Topic: How do I add buttons to the babylon and classic style themes?
 
Install SMF Installing Upgrading Converting
Using SMF User Moderator Administrator
Advanced Mods and Themes More Info
Glossary Terminology FAQs References Feature List What's New
Comments Feedback Requests

Updated Documentation: The Online Manual has moved. All updates to the documentation are now taking place in the new Online Manual. Please see the new Online Manual, and learn how you can help, as it continues to grow and improve.

Updated content on Wiki: This documentation is outdated, please refer to the wiki article for more up to date information.

« previous next »
How do I add buttons to the babylon and classic style themes?
To add a button to the Babylon/Classic YaBB SE themes (or any theme that is based off of them) you first need to make sure that your custom action is available for SMF to go to. For this example we will add a Chat button.

Start off by opening the Themes/babylon | classic | custom_theme/index.template.php file, in this example, we will place the button after the Profile button.

So look for:

Code: [Select]
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

and after that, place:

Code: [Select]
// The Chat Room
echo '
<a href="', $scripturl, '?action=chat">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="Chat" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

Then save that and upload the files to your forum, overwriting the existing file.

If you are showing the buttons as images instead of text you will also need to create an image button with "Chat" written on it, save it as chat.gif and upload it to your theme's images/[language] directory as well. (Where [lauguage] is your language)

If you would like the link to go to an external location, you would want to make this part:

Code: [Select]
<a href="', $scripturl, '?action=chat">
To something similar to this:

Code: [Select]
<a href="http://www.simplemachines.org?">
Notice the removal of the ', $scripturl, ' part.
Print
Reply
Reply with quote



Comments:
fadun made the following comment on November 13, 2008, 05:12:40 AM:

Thanks for that valuable information. How then can i link up the newly created button with the appropriate page,
say for example linking the CHAT button to my chat room?

Jade made the following comment on November 13, 2008, 08:31:15 AM:

Please read the stuff underneath the "If you would like the link to go to an external location, you would want to make this part:" heading :).

Lia made the following comment on March 27, 2009, 07:28:22 AM:

If i don't want to add an image but a text, what should i type??

Jade made the following comment on March 28, 2009, 04:51:54 PM:

Remove the "img src" code :) Like so:

Before:

Code: [Select]
<a href="', $scripturl, '?action=chat">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="Chat" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];
After:
Code: [Select]
<a href="', $scripturl, '?action=chat">' , $txt[467]), '</a>', $context['menu_separator'];
Of course, if you are using the Core theme, it will be different:
http://docs.simplemachines.org/index.php?topic=564.0

Nikel made the following comment on May 05, 2010, 04:06:03 PM:

How could I add this on a custom theme? I'd use Overview theme and an SMF 2.0 RC3. I'd like to know how to add "Website" before the "Home" button in the navbar. Would be appreciated if you could help.

Acans made the following comment on August 29, 2010, 01:31:30 AM:

@Nikel

Please ask for support at www.dzinerstudio.com

Overview was created by dzinerstuidos and you will get the best support their.


Advertisement:
  • SMF 2.0.1 | SMF © 2011, Simple Machines
  • XHTML
  • WAP2

Page created in 0.056 seconds with 19 queries.
Page served by: 10.0.100.135