01-09-2011, 05:10 PM
Whether your wanting to start customizing the source or just getting familiar with adding features, knowing how to do things with forum software is essential to solving problems and knowing how to effectively use features provided for you.
Below are some key topics which will help guide your way through SMF.
Adding new navigation tabs
Adding new tabs to the navigation bar is what most people want to do when customizing. How to do this with SMF 2.0? First off, head into your Sources/Subs.php and search for the following code,
You guessed it! This array holds information for the Home tab. Adding a new tab is simple, just add it according to what position you want it displayed in. For example, if you wanted a new tab beside the Home tab on the nav bar, add this code directly under that one,
In SMF 1.1.x, open your Theme/index.template.php, and find the following,
Below that will be a snippet for the home button. If you want to add a new button, just place it under the tab you want it to appear beside, as such,
That should be pretty self-explanatory. Incase your wondering what the $current_action variable does, its simply a variable that stores the current action from your action GET array. So if your currently on: http://mysite.com/index.php?action=lolwut
The $current_variable will store that as its value. Also, before I forget, for SMF 1.1.x, to have the tab show properly find,
And add this snippet below,
Or you can simply just place it in the above if-statement.
Adding content around the copyright
This next topic will show you how to add content above that [URL="http://www.simplemachines.org/"]Powered by SMF 1.1.12[/URL] | [URL="http://www.simplemachines.org/about/copyright.php"]SMF © 2006-2009, Simple Machines LLC[/URL] string. In SMF 2.0 its real easy, and I can say the same for the 1.1.x version as well. Head into your Theme/index.template.php file and search for the following,
Its as simple as appending a break line (<br />) tag to the first apostrophe and adding text before it. As such,
In 1.1.x its just about the same place, head into the same file and search for,
Hopefully you get it by now.
Adding content to every SMF page
Ever notice how some parts such as the user header is displayed in all pages? Its simple, editting the main template file directly. In SMF 2.0, search for the following,
And below that last line you would add your content in an echo and such.
In SMF 1.1.x search for the same file (Theme/index.template.php) and search for,
Under that echo just add your content.
Adding new pages to SMF (not very basic)
Since this is a more broad topic, the tutorial can be found here,
http://www.supportforums.net/showthread.php?tid=15449
Additional Resources
I use the following resources when looking for already existing tune-ups or tutorials on utilizing SMF;
Thanks for reading.
Below are some key topics which will help guide your way through SMF.
Adding new navigation tabs
Adding new tabs to the navigation bar is what most people want to do when customizing. How to do this with SMF 2.0? First off, head into your Sources/Subs.php and search for the following code,
PHP Code:
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
PHP Code:
'button_name' => array(
'title' => 'The Tab Title',
'href' => 'the hyperlink reference to where it should go (the link)',
'show' => true, // boolean value indicating whether to display it or not
'sub_buttons' => array( // additional buttons you want displayed (dropdown buttons)
// if you want a dropdown button, simple add the same above:
// title, href, and show
),
),
In SMF 1.1.x, open your Theme/index.template.php, and find the following,
PHP Code:
// Show the [home] button.
PHP Code:
echo ($current_action=='action_name' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'action_name' ? 'active_back' : 'back' , '">
<a href="LINK HERE">TAB TITLE HERE</a>
</td>' , $current_action == 'action_name' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
The $current_variable will store that as its value. Also, before I forget, for SMF 1.1.x, to have the tab show properly find,
PHP Code:
if ($context['current_action'] == 'search2')
$current_action = 'search';
PHP Code:
if ($context['current_action'] == 'action_name')
$current_action = 'action_name';
Adding content around the copyright
This next topic will show you how to add content above that [URL="http://www.simplemachines.org/"]Powered by SMF 1.1.12[/URL] | [URL="http://www.simplemachines.org/about/copyright.php"]SMF © 2006-2009, Simple Machines LLC[/URL] string. In SMF 2.0 its real easy, and I can say the same for the 1.1.x version as well. Head into your Theme/index.template.php file and search for the following,
PHP Code:
<li class="copyright">', theme_copyright(), '</li>
PHP Code:
<li class="copyright">This is a useful, centered string. :D<br />', theme_copyright(), '</li>
In 1.1.x its just about the same place, head into the same file and search for,
PHP Code:
<td valign="middle" align="center" style="white-space: nowrap;">
PHP Code:
', theme_copyright(), '
</td>
Adding content to every SMF page
Ever notice how some parts such as the user header is displayed in all pages? Its simple, editting the main template file directly. In SMF 2.0, search for the following,
PHP Code:
// The main content should go here.
PHP Code:
echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">';
// Custom banners and shoutboxes should be placed here, before the linktree.
In SMF 1.1.x search for the same file (Theme/index.template.php) and search for,
PHP Code:
// The main content should go here.
PHP Code:
echo '<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';
Adding new pages to SMF (not very basic)
Since this is a more broad topic, the tutorial can be found here,
http://www.supportforums.net/showthread.php?tid=15449
Additional Resources
I use the following resources when looking for already existing tune-ups or tutorials on utilizing SMF;
- Twenty-four things you can do to make SMF go faster -http://www.simplemachines.org/community/...;topicseen
- http://wiki.simplemachines.org/smf/SMF_F...r_Meanings
- Tips and Tricks - http://www.simplemachines.org/community/...board=72.0
Thanks for reading.