Getting the website template to work
Starting
You can start off with any HTML/CSS webpage template: use an existing template, create a new layout or download a free one from the web (freecsstemplates.org, Layout Gala etc). We are also are planning to release some nice templates here on the RuubikCMS website.
Getting your HTML/CSS template to work with RuubikCMS is done by throwing in some easy PHP code snippets in the template HTML which is saved as /index.php. For example where you like the page content HTML to appear you would insert the following code:
<?php echo $page['content'];?>
And to insert the main menu HTML:
<?php echo $page['mainmenu'];?>
RuubikCMS comes with a demo website which uses all the common features. You probably should take a look at it (/index.php) when creating your first own RuubikCMS site.
See the complete list of all template PHP codes
Site template directory structure
The included demo site uses the following directory structure:
| File | Purpose |
| /index.php | Template main page |
| /ruubikcms/website/css/ | Template CSS files |
| /ruubikcms/website/css/ | Images used in template CSS files |
| /ruubikcms/website/images/ | Other images used in template HTML |
| /ruubikcms/website/scripts/ | Possible JavaScript files needed in your template |
Note that all images, files and videos uploaded in RuubikCMS by CMS users go to /ruubikcms/userupload/ and its subfolders.
The thing with absolute URLs in index.php
There is this one peculiar thing to know when creating the site template and index.php. If the Clean URL option in Site Setup is enabled (default), all URLs in index.php must be absolute!
This really means all the internal hyperlinks in index.php: linked CSS-files, images etc. So the URLs must begin with a '/' and must reference the whole path from www root directory. Relative URLs will probably not found the right file.
Using absolute URLs is certainly not nice when you have to move your site to a diffrent subdirectory. To help this there is a page template code which automatically gives you the site root folder, i.e., the beggining of every hyperlink:
<?php echo $page['siteroot'];?>
This can be used in CSS files (or images):
<link rel="stylesheet" type="text/css" href="<?php echo $siteroot;?>ruubikcms/website/css/style.css" />
This absolute URL behaviour is somehow caused by the Clean URL scheme where there is a slash following the index.php: index.php/mainpage/subpage. It would certainly be nice to get this solved properly and any help is appreciated! If the Clean URL option is disabled you can use relative URLs as usual.
