Mambo, like any other CMS, stores chunks of text in a database, and it uses templates to arrange and format these chunks of text on the screen for you. That way, if you want to change what's on the site, you tell Mambo what chunks of text to show and what chunks of text not to show.
Content are the blocks that show up in the center area of the screen. Dynamic content is grouped into Sections and those are further divided into Categories. That way instead of having to individually choose which content to add to a menu, you could just choose a whole category or section. It just makes it easy to organize content. If there's content on the site that you don't need, the correct way to get rid of it is to unpublish it through the content manager.
Modules are all the junk that shows up around the sides, top, and bottom of the page. Some modules are just blocks of text or links, and some of them do stuff like tell you who's logged in or display a poll. Modules are assigned to module positions around the screen. You can control which module position they occupy. The correct way to get rid of a module is to unpublish it from the module manager. The correct way to move a module to a different location is to just assign it to a different module position. You can assign several modules to the same position, and they'll show up one after another inside the same box. You can see where these boxes are located by choosing "Preview" from the site menu and from that choosing "Inline with Positions".
This is the key skill in controlling Mambo layout-- knowing how to move the modules where you want to and turn off the ones you don't want.
Then there are the templates. The main thing templates do is specify where each position will be on the sheet... positions to which you can assign different modules from the Site Models item in the Modules menu. It's not unheard of to have a two column layout (Planetfall for instance) with the module position called 'left' showing up on the right side of the page... that's just how somebody wrote that particular template.
The best way to write your first template is to first write a static HTML file that looks like you want the page to look. I wrote mine as just a barebones table and did all my formatting in CSS, but it doesn't matter how you choose to do it. It will still work.
Let's say your template is named Foo. Create a directory called \mambo\templates\foo . Create directories inside that named css and images. Put your stylesheet inside the css directory and name it template_css.css. Move the static HTML file to the top level of the foo directory and name it index.php. Copy over a templateDetails.xml file from one of the other templates and edit it so that it describes your template instead. Open up a user window while your default template is still selected. This is going to be the one you're referring to (especially in view source mode). Then switch to the new template you created. Open up a second user window. This is going to be the preview window and you'll be refreshing it a lot. You'll notice that even though it's not really a PHP file (yet) it still renders just fine... just a little empty because it doesn't have any CMS content in it yet.
In the admin browser window, go to one of the real templates and copy the following code to your template, replacing whatever was above the <body> tag...
Then scroll through there and look for table cells or other places where you want to put in modules. Replace the placeholder text or whatever you have there with this...
<?php mosLoadModules ( 'user4' ); ?>
this PHP statement will display all the modules assigned to the module position named 'user4' wherever in your document you embed it. The other module positions (IIRC) are...
user1-user9, top, bottom, left, right, banner, debug, and a ton of others. Nobody's forcing you to use them all. Somewhere in the central content cell you'll want to put <?php mosPathWay(); ?> and <?php mosMainBody(); ?>
These place the breadcrumb trail and the main body content.
Periodically save your work and check it by refreshing the window you opened earlier. Eventually you'll have all the content arranged the way you like it. Then it will be time to specify classes or ids on tags that contain modules or content, so that afterward you can refer to these classes and ids from the CSS file. That's for a CSS tutorial to explain, and there are plenty of those out there. But the important thing is, you've just taken an ordinary HTML page and step-by-step converted it into a Mambo template. Congratulations!
Content are the blocks that show up in the center area of the screen. Dynamic content is grouped into Sections and those are further divided into Categories. That way instead of having to individually choose which content to add to a menu, you could just choose a whole category or section. It just makes it easy to organize content. If there's content on the site that you don't need, the correct way to get rid of it is to unpublish it through the content manager.
Modules are all the junk that shows up around the sides, top, and bottom of the page. Some modules are just blocks of text or links, and some of them do stuff like tell you who's logged in or display a poll. Modules are assigned to module positions around the screen. You can control which module position they occupy. The correct way to get rid of a module is to unpublish it from the module manager. The correct way to move a module to a different location is to just assign it to a different module position. You can assign several modules to the same position, and they'll show up one after another inside the same box. You can see where these boxes are located by choosing "Preview" from the site menu and from that choosing "Inline with Positions".
This is the key skill in controlling Mambo layout-- knowing how to move the modules where you want to and turn off the ones you don't want.
Then there are the templates. The main thing templates do is specify where each position will be on the sheet... positions to which you can assign different modules from the Site Models item in the Modules menu. It's not unheard of to have a two column layout (Planetfall for instance) with the module position called 'left' showing up on the right side of the page... that's just how somebody wrote that particular template.
The best way to write your first template is to first write a static HTML file that looks like you want the page to look. I wrote mine as just a barebones table and did all my formatting in CSS, but it doesn't matter how you choose to do it. It will still work.
Let's say your template is named Foo. Create a directory called \mambo\templates\foo . Create directories inside that named css and images. Put your stylesheet inside the css directory and name it template_css.css. Move the static HTML file to the top level of the foo directory and name it index.php. Copy over a templateDetails.xml file from one of the other templates and edit it so that it describes your template instead. Open up a user window while your default template is still selected. This is going to be the one you're referring to (especially in view source mode). Then switch to the new template you created. Open up a second user window. This is going to be the preview window and you'll be refreshing it a lot. You'll notice that even though it's not really a PHP file (yet) it still renders just fine... just a little empty because it doesn't have any CMS content in it yet.
In the admin browser window, go to one of the real templates and copy the following code to your template, replacing whatever was above the <body> tag...
| Code: |
| <?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); // needed to seperate the ISO number from the language file constant _ISO $iso = explode( '=', _ISO ); // xml prolog echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php if ( $my->id ) { initEditor(); } ?> <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" /> <?php mosShowHead(); ?> <link rel="stylesheet" type="text/css" href="<?php echo $mosConfig_live_site; ?>/templates/JavaBean/css/template_css.css" /> </head> <body> |
Then scroll through there and look for table cells or other places where you want to put in modules. Replace the placeholder text or whatever you have there with this...
<?php mosLoadModules ( 'user4' ); ?>
this PHP statement will display all the modules assigned to the module position named 'user4' wherever in your document you embed it. The other module positions (IIRC) are...
user1-user9, top, bottom, left, right, banner, debug, and a ton of others. Nobody's forcing you to use them all. Somewhere in the central content cell you'll want to put <?php mosPathWay(); ?> and <?php mosMainBody(); ?>
These place the breadcrumb trail and the main body content.
Periodically save your work and check it by refreshing the window you opened earlier. Eventually you'll have all the content arranged the way you like it. Then it will be time to specify classes or ids on tags that contain modules or content, so that afterward you can refer to these classes and ids from the CSS file. That's for a CSS tutorial to explain, and there are plenty of those out there. But the important thing is, you've just taken an ordinary HTML page and step-by-step converted it into a Mambo template. Congratulations!
