Integrating SMF with your website From Online Manual
Integrating Your Site and Forum - Visually
In many cases, people want their forum to look like their main site. To make this possible might take a little bit of work, but it really isn't all that difficult.
The first step is to know some basic CSS and HTML. If you don't know these, and cannot bother to learn them, I hope you're willing to pay someone to help you. Learning just basic CSS and HTML isn't that difficult, and the benefits are wonderful and great; I'm not writing this for those who want things handed to them on silver platters. Sorry to those who don't for having to say that.
Some guides on CSS and HTML are available here:
When I say HTML, I really mean XHTML, but the difference is more like a new version than a separate language. XHTML is preferred, but if you know HTML it should be fine. For more information on them and their differences, see the tutorials above.
Next, you'll want to make a copy of the default theme. To do this, go into your administration center, and select "Theme and Layout Settings". From there, under "Install a New Theme", type a name for your theme next to "Create a copy of Default named" and click Install! You will be prompted to click OK - please do so.
Now you have a copy of the default theme. If you want to customize the images for your theme, go to the theme's settings and change the URL from default/images to "yourname"/images, and use an FTP client to copy the files from default into your theme.
After this is done, you can use the style.css in your theme's directory to customize most of the colors. Of course, this isn't exactly what you're looking for, but bare with me and get those customized. There are comments in the file, but the main ones to worry about are titlebg (blue), windowbg and windowbg2 (shades of gray), and bordercolor/tborder. (backgrounds for tables, grid lines, etc.)
Moving to Your Layout
The next step is, of course, to make it look like your site. I assume that, to do this, you already have a "template" of sorts made out of html - your site without the main content. If you don't, making one would help markedly, but you may be able to wing it too.
Once you have this done, you'll want to split it into two parts: the header, and the footer. Doing this makes it much easier to customize things, and can even make it easier to design your own site (with basic shtml or PHP includes.) Put these two parts in a "header.php" and "footer.php" - don't worry, they don't have to have HTML in them at all, but they can.
The next step can be done in two separate ways. One is cleaner, and makes it easier to use SSI to power your site (as is done here.) The other is notably simpler and easier. I'll cover the simpler one first.
You may notice that there's a lot of stuff in the header of the index template. Much of this can be omitted, which is what we're going to do for simplicity's sake. So, what we need to do is find the following:
And keep going down until:
Delete it all. We're going to start fresh, and simpler. All you really need is: (note that this will screw up mutliple language support!)
That's probably less scary, right? If you want the things we just took out (which make browsing better in cases, and internationalization better, etc.) it can be left in. Now, after the <body> should be a ';. Make sure to leave that there. After that line, add:
If you didn't put header.php in the same place as the forum, you may need to make it '../header.php'. After that, we're going to remove the upshrink part (assuming you remove the above part) because it won't work anymore. That means removing:
<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 0;" border="0" /></a><img id="upshrinkTemp" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 2ex;" />
Again, don't remove that last [tt]';[/tt] because it makes things work. Okay, so we're almost done now. The next step is to add the footer. To do that, look for:
Above that, you will see a line that says echo ' - and, above that, we want to add:
Again, if you put the outside the forum's directory, you'll want to use ../ to "get to it". That was the basic method.
I'll post the more advanced method in a reply.
The Cooler Way - Layers
This other way, we're going to use what are called "layers". Because of this, we will need to make a small change to the database. If you don't have a way to get to the database, such as phpMyAdmin, you may wish to install and learn how to use it (phpMyAdmin, I mean.)
So, creating the layer only means creating two sub templates. At the end of index.template.php, right before the ?>, add:
Again, if you have the header.php and footer.php files outside of your forum directory, you may have to change those lines slightly to point things to them. So, if they're in your site's directory, just outside the forum directory, use ../header.php and ../footer.php.
The next step is to remove the shrink thing, since it won't work. As said above, find and remove:
Again, don't remove that last '; because it makes things work.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
And then removing:
echo ' </body> </html>';
Now, if you did this, and went to your forum, it'd look REALLY CRAPPY. There's one last vital thing that needs to be done for it to work. And to do that, we need the id of the theme we're working with.
To find this id (which, if you've only created one theme, will be 3) you will need to check the link to "preview" it in your profile. You'll see it say "theme=xyz". The number (I put xyz but it should be a number) is the id. Once you have that, you want to write the following query in phpMyAdmin - go to your database and pick the SQL tab, and type in the box:
REPLACE INTO yourprefix_themes (ID_THEME, variable, value) VALUES (that number, 'theme_layers', 'site,main');
(where yourprefix_ is your prefix, often 'smf_' and that number is the theme id we found.)
By the by, if you're wanting to distribute your theme, and use layers, look in the file named "theme_info.xml". It has a special spot just for this information. Remember that the layers are loaded in the order listed - in this case, it goes site_above -> main_above -> content -> main_below -> site_below.
Wonderful. You're done, and everything looks fancy. But, now, you probably did this to use it with SSI - how does one do that? Try the following code, in a PHP file:
<?php error_reporting(E_ALL); $ssi_theme = that pesky number again; $ssi_layers = array('site'); // If you want SSI.php to start gzipping for you ;). $ssi_gzip = true; require('forum/SSI.php'); echo 'some stuffs go here.'; ssi_shutdown(); ?>
(where that pesky number again is the theme id, and forum/SSI.php is where ever SSI.php is - not a URL.)
I'll admit a more complicated system is used for this site, but the example given should be more than enough to help you power everything through SMF and its template system, should you wish to.