Home arrow Developers arrow Developer arrow Modify an SMF theme for Joomla and Mambo
 
Modify an SMF theme for Joomla and Mambo - Intro Print E-mail
Article Index
Intro
Removing excess tags
Removing extra theme info
Removing conflicting CSS
Conclusion

Introduction to using an SMF theme with Joomla or Mambo

Welcome to my tutorial on modifying a theme for SMF to work with Joomla or Mambo. (Themes are the SMF equivilent of a Joomla/Mambo template, though really it is a collection of templates.) If you would like to see this tutorial in Portuguese, buf posted a translation here. There are several ways to go about doing this, but I think this method is the best.  It will allow your theme to be used when accessed wrapped in Joomla or Mambo, as well as still be functional when accessed unwrapped or stand alone.  It will remove the usual conflicting CSS when wrapped, as well as excess headers or sidebars.

The key to achieving this is a conditional statement that Kindred on the forums showed me:
Code:
if (empty($_REQUEST['option'])){
}
What this does is check to see if a the global variable $_REQUEST['option'] has been set, which is something Mambo or Joomla will do.  This might work for some other CMSs, too, that use this method, though I haven't tested any others.

Occasionally, you might want to do the opposite, and have something show up only when you have the forum wrapped - for instance, in one theme I was working on, I needed it to have a "colspan=2" only when wrapped, because of some things I removed. In that situation, you would use this code:
Code:
if (!empty($_REQUEST['option'])){
}

Basically, the same thing, but saying if it is NOT empty.

Preliminary information

To demonstrate this, I am going to use the SMF default theme for SMF 1.1 RC1, (in SMF 1.1 RC2, this is now known as the Babylon theme, but the tutorial should still apply. If you just want a modified version of the RC2 default theme, check the downloads section.)  While doing this, I believe the best practice to be to extract the theme locally to work on, and test your modifications as you go.  If you would like to keep your original theme separate (which I highly recommend), you will want to re-archive your new theme with a different filename, and edit the theme_info.xml file and edit the <name></name> setting.  That way it will install in to a different directory, and show up with a different name than the original.
Side Note
There are really only two files you should need to edit, index.template.php and style.css.  However, we are copying the entire theme so that you are able to release it stand-alone to those who may not have the original.  If you really want to do this with the default theme, you can use the "Create a copy of Default named:" option in the theme installer, and just work with the files that it makes.

Preparing to edit

First, extract or copy the original version of the theme to a local directory where you can do the editing.  You probably want this directory name to be something different from the name of the file the theme is distributed in - for instance, if the original theme is distributed in foo.zip, don't extract it to a directory named foo, instead, use a directory named foo-joomla.  This is to help differentiate it from the original, which by default will be installed on your server in a directory that is the same name as the file.  For our demo we will be copying the entire "/Themes/default/" directory in to a directory named "/Themes/default-joomla/".


 
 
© 2010 technoadvice.com
Joomla! is Free Software released under the GNU/GPL License.