Hello there, ever since I installed Mambo a few weeks ago for the first time I wanted to find a way to have MOS modules in my existing website (which had its existing template, scripts etc).
This tutorial is intended for those who don't want to make modifications to the core but want to be able to "pull" Mambo modules into non-Mambo pages. In the same way you can actually pull mambo content (ie componets) into non-Mambo pages.
There are a few different ways to achieve this but I will go with the easiest one, that requires the least amount of coding.
What I'll be discussing here is how to achieve such an integration without changing a single line of code in the Mambo core. I have done this on Mambo 4.5.1a. I have never used previous versions nor tested 4.6 or other later beta versions but I am pretty sure this method would be compatible with all versions because it relies on Mambo's very own features, not on external tricks/code/hacks etc. Basically I like to think of it this way: I am using Mambo's potential to trick Mambo itself into complying with my non-Mambo content pages...
For the sake of the example we will assume that you want to have the '
left' column of your Mambo pages in non-Mambo pages as well... Obviously if you want the right column you'll replace '
left' with 'right' or if you want your custom 'user1' column you'll replace '
left' with 'user1'. The way this method is conceived it won't allow you to pull only a few selected site modules into your non-MOS pages individually, but you can pull all the modules within a position (be it '
left', 'right', 'user1' or whatever).
You will notice I have colored the word left anywhere in this post to make this replacement easy for you.
Here we go:

First, you must create a new template. To do this go in your MOS installation folder, then navigate to 'templates' and create a new folder called, let's say, '
left'.
Inside this folder you will have to place ONLY two files (if you have security concerns you might want to also copy the blank
index.html from any other template as a third file, but it is not mandatory at all).
These two files will have to be named:
index.php and
templateDetails.xml.
NO OTHER FILE or subfolder IS NEEDED.
The content of your
index.php will be the following:
PHP Code:
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
mosLoadModules('left');
?>
Please note: the above word '
left' in the mosLoadModules('left'); should really be coloured in red (to be compliant with this post's standard conventions, where I would color red all the instances of the word 'left' to later be replaced by right or user1 or whatever the column is that you want to show/pull in your static non-MOS pages) but I had to leave it black because this board's BBC code wouldn't work within the php tags, that's all. Thanks to dylan for pointing it out.
The content of the
templateDetails.xml file will be the following:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="template" version="4.5.1">
<name>left column</name>
<creationDate>11/01/04</creationDate>
<author>you</author>
<copyright>GNU/GPL</copyright>
<authorEmail>you@yourdomain.tld</authorEmail>
<authorUrl>http://www.yourdomain.tld</authorUrl>
<version>1.0</version>
<description>Your description.</description>
<files>
<filename>index.php</filename>
</files>
</mosinstall>
Upload all of this if you have done it locally.
Please note you will have to create one template for every column that you want to add into your non-MOS pages. If you want a column on the left and one on the right, you'll have to create two templates. For my site
http://www.chaindlk.com I have created 6 templates to achieve the 6 boxes in the left and right column that you see... And, needless to say, anything that is said from here on after will have to be repeated for every column that you want to have in your non-MOS pages as well.

Ok, great. Now that this is done, you're practically done with any code you'll have to deal with for this. Easy right? The next step will be to create a new menu item. You won't want this menu item to appear in your regular menus so I suggest that you first go to your 'Menu Manager' in Mambo's administration. Create a new menu and call it for example 'external un-necessary menu' or whatever. This menu won't have to be showed anywhere on your site, it's just needed for the next step. Within this new meny create a new menu item, select the 'Wrapper' component and then give it the title '
left', insert a dummy url in the Wrapper Link field (can be your website's url or whatever). Actually you could even leave it blank, I haven't tested it but none of these settings are really needed, we just need to create a new dummy menu item to trick Mambo into thinking that there is a new menu item (you'll understand why later). On the same note I just realized that you could also simply NOT publish this menu item instead of doing the above (create a new 'external un-necessary menu' menu and then create a new menu item within that... If I had thought of this when I developed this method I would have done just this: choose the 'No' radio button next to the 'Published:' option, but I just thought of it right now myself. Save the menu item.

Now the important thing. Once you save you are brought back to the menu manager. Now you have to click on the menu you have just created and read the URL that wasn't there before (because Mambo has created it upon your previous save action). This URL will look something like this: index.php?option=com_wrapper&Itemid=XX where XX is a number. You must copy or remember this number for later use.

Anyway, off to the next step. The core of the method, thanks to which all of this is possible (courtesy of Mambo

). Go to Site > Templates Manager > Site Templates. If you have done everything correctly in step 1 then you should now see your template called '
left column' (as per xml <name> tag). Click on its radio button (on its left) and then click on the Assign image/button at the top-right corner of your Mambo administration. Now you will want to pick your dummy previously created
left menu item from the select list and then click on the Save button.
As for Mambo administration, you are now done, and you can close or log out from its control panel.

Step 4 consists of putting some code in your non-MOS pages to recall your
left column in them. Open your php page and wherever you want to see your MOS column, add the following code:
PHP Code:
<?
include('http://www.yoursite.tld/yourMOSinstallationFolder/index.php?option=com_wrapper&Itemid=XX');
?>
where:
-
www.yoursite.tld is the url of your site
- yourMOSinstallationFolder is where your MOS installation is (if you have installed Mambo in the root simply adjust the url/path removing it alltogether, along with one of the forward slashes of course)
- XX is the number you should still have in your clipboard memory (or in your human memory).
Please note that this must be a full URL. You can NOT use neither a relative URL nor a path starting with $_SERVER['DOCUMENT_ROOT'] or anything like that because that will not send the query string along with the include.
Now you are 99% done.
If you have done everything correctly and if navigate to the non-MOS php page that you have just edited and then uploaded, you will now see your non-Mambo php page with the contents of your Mambo pages'
left column in it. Magic!
Because of the stupid 10000 characters limitation for this forum's posts (wow I didn't realize I have written this much, sorry if I am boring you, I am just trying to be precise so everybody can follow) I will have to continue this in the next post (see below).