Building a Twitter Bootstrap template
The following is a guide for creating a Soholaunch template with Twitter Bootstrap.
Here’s the complete working template file that this guide uses: http://site.soholaunch.com/media/bootstrap-basic-gray.zip
Feel free to download it and use it.
Main getting started steps:
- Download the CSS version of bootstrap at: http://getbootstrap.com/
- Put the zip in your template folder. Here’s the path: sohoadmin/program/modules/site_templates/pages . And extract the zip.
- Add an index.html file. As of this writing, a default index.html doesn’t come with the zip, but Bootstrap’s example templates are here, under “examples”: http://getbootstrap.com/getting-started/
- If using one of their templates, open one in your browser, view the source and copy and paste it into your index.html file and save it in your template folder. This guide uses the “Jumbotron” template.
- Add the #relative_template_path# pound variable to any links to Bootstrap’s default stylesheets.
- Add the pound variables, a custom.css file, and then start making your template.
(that is, not the Less or Sass versions. You can use Less or Sass, but this guide covers using the CSS version for now)
The main things menu needs are certain css classes added to different elements. Copy the pgm-auto_menu.php found inside the zip file at the top of this doc, and paste it into your template folder. We added the required classes to it to make the menu work (like collapse into the “hamburger” icon, and retain all the drop-down menu items)
Add the #hmains# pound variable into the correct place in index.html for the menu. It’s usually where the template starts building out the menu with unordered list items (i.e. ul’s and li’s)
Our index.html and commentary
If you take a look at the index.html file in our template zip, you'll see we made a few changes. We had to change a few things from the Jumbotron template code that we copied and pasted. Below are the main highlights so you don’t miss anything:
- There is no “jumbotron.css” stylesheet in the default download zip, so we just deleted that link in our index.html and it didn’t seem to matter.
- We commented out any forms that came with the template. Soholaunch lets you drag and drop login and search boxes already in the page editor.