Learning Mambo: A Step/by/Step Tutorial to Building Your Website
上QQ阅读APP看书,第一时间看更新

Your Mambo Site

Navigate to the frontpage of your site in your browser. For our newly installed Mambo site, this will be http://localhost/mambo/. You should be presented with the following screen, which we saw at the end of the last chapter:

Your Mambo Site

Considering that we've not really done anything, this is impressive. I'm sure you won't be able to resist clicking on some of these links and seeing what Mambo has in store for us. Of course, this isn't our site; everything that you see on the page comes from the Mambo example database, and I doubt that you plan to create a site that has the same content as this. For now, it gives us something to see and interact with to get a better feeling of how Mambo works.

Rest assured that over the next few chapters things will really start to heat up as we begin the creation of our new site.

Let's first talk about what we can see on the frontpage.

At the top, there is a site logo, a horizontal navigation menu, and a site banner image, often referred to as the masthead:

Your Mambo Site

The page body begins underneath this header. You can see that the layout of the body essentially consists of three columns with a big chunk of information in the middle column. The page layout of a Mambo site need not always look this; the arrangement of the elements, the choice of color, text styles, and images is controlled by the template. A different template can be selected for the site, and immediately, the look and feel of your site is changed.

Menus

The horizontal navigation menu at the top of the page is an example of a Mambo menu:

Menus

As you would expect, a menu in Mambo is there to provide navigation for the visitor. On our frontpage there are three menus displayed:

  • Top menu
  • Main menu
  • Other menu

The Top menu is the horizontal navigation menu we have just seen. It provides the visitor with quick access to what are considered the most important parts of the site.

The Main menu (located in the left-hand column) is the key navigation element of a Mambo site:

Menus

You will be familiar with this type of menu from almost every website that you have visited. This menu shows the main destinations within the site. The Home link is always found on a Mambo main menu, and returns you to the frontpage of the site, or the "homepage", however you want to call it.

Sometimes, when you visit certain pages (the FAQs page for example), the menu entry for that page will expand to show a list of further pages within that part of the site:

Menus

The Other menu (that is what it is called in Mambo; it's not just that I couldn't think of a name for it) contains other links. Currently, it is found under the Main Menu, and here it contains links to the main Mambo sites, and also a link to the Administrator area of our site.

Menus

Note

One thing to note with Mambo is that the Main Menu, your primary navigation object, does not automatically fill up with links to different pages on your site. After creating a page or piece of content on your site you will need to add a link to one of these menus for the visitor to find it.

However, it would be absurd if every page on your website had to appear in one of these menus. If you had a large site, your menus would become massive and also cease to be useful to the visitor. As we will see, Mambo can automatically display lists of pages that come under the current page that you are viewing.

Note

There is a fourth menu, the User Menu, but you can't see it on your page at the moment. It is only displayed once a visitor has logged into their user account. We'll see more of this menu in Chapter 7.

Modules

The menus that we have just seen are actually examples of a Mambo module. Modules in Mambo are little nuggets of information, which are scattered across the page, at the sides or above the main part of the content. They are similar to the sidebar blocks of information in a newspaper, providing weather information, brief headlines, and other snippets of information related to the main stories in the newspaper.

The menu modules for example provide navigation, linking to other parts of the site, while other modules provide a report or summary of the content that is available either on your site or, possibly, on another site. Typically, many modules are displayed on a single page.

On the frontpage, in addition to the menu modules, we can see the Latest News and Popular modules:

Modules

These two modules appear in the middle of the page, above the main page content. The Latest News module displays the titles of the most recently posted articles, and the Popular module displays the titles of the most viewed articles.

On the left-hand side of the page, under the Main Menu and the Other Menu, is the Login Form module:

Modules

This module presents a form for visitors to enter their login details, and then click the LOGIN button. If they don't have an account on the site, there is a Create one link to create an account. You will notice the Password Reminder link, with which (forgetful) users can be sent an email reminding them of their password. This is more evidence of how Mambo will take care of the tedious little details that are part and parcel of managing a sophisticated website.

If this module were to be removed from your pages, it would of course make it more difficult (but not impossible) for visitors to log in. If you click some of the links in the Main menu, then you will notice that the Login Form module does not show on all pages; in fact, it is only shown on the frontpage.

Note

A module need not appear on all pages of the site; you can choose to have your module appear on only certain pages.

You will notice a commonality to the module display; there is a title bar, followed by the body of the module. However, not all modules need to look like this. The Search module (by default at the top of the right-hand column of the page) has no title bar:

Modules

Each module is configurable from the administration area as we'll see in the coming chapters. One thing that can be configured is whether or not to display the title of the module. The ability to configure each individual module like this means that there can be some variety on your page.

Components

See the bit right in the middle of the frontpage? That's the output of the current component.

Mambo is a component-based system. Each component is like a mini website in itself, performing different tasks and working with different types of content. The Mambo 'core' provides a central mechanism for handling these components, so that they work together sharing data and user information, and ensuring a consistent look and operation throughout your site. In short, the components define the functionality of your site.

The good thing with Mambo is that you can add and remove components to your heart's desire, selecting the best range of features to suit your site and its visitors. We will discuss the standard Mambo components over the next few chapters, but they are only the tip of the Mambo iceberg. There are numerous third-party components that can be downloaded and installed, covering a massive range of activities. The choice of available components is something that makes Mambo such an appealing system.

When viewing a page on a Mambo site, the component currently in play can be determined by looking at the URL of that page. For example, click on the Getting Started link, and the page will have a URL like this:

http://localhost/mambo/index.php?option=com_content&task= category&sectionid=4&id=16&Itemid=27

The part of the URL after the ? character is the query string. The query string contains variables that are separated by the & character. In the above URL, the query string variable option has the value com_content. Mambo switches between components according to the value specified in the option query string variable.

Within a single component there are typically a number of different activities to be done, and the other query string variables indicate to the system which of these activities the visitor wants to perform. They also identify which item of data should be displayed. For example, on the Getting Started page, the URL is:

http://localhost/mambo46b1/index.php?option=com_
content&task=category
&sectionid=4&id=16&Itemid=27

Here, the task variable (which has the value category) is indicating that a list of the items in a "category" should be displayed, with the other variables specifying more information about which "category" is chosen.

The output of the component being currently viewed is displayed in the middle of the web page, and is generally the central focus of a page on a Mambo website.

The visitor isn't particularly aware of which component is being presented to them; as the visitor clicks links on the various menus and travels to different pages, Mambo will select the required component and display it to them.

Templates

The way the page has been laid out is not fixed in Mambo. The look of the page, the organization of where the modules sit, the colors, spacing, background images used, and so on, are all controlled by the template. Mambo allows you to select a new template, and immediately, the look of your site will be transformed.

In Mambo, there is no reason why the same template has to apply to all pages; you can assign a different template to certain pages on your site.

The default template, Water and Stone, looks OK (though a bit too much gray I'm sure you will agree), but there are countless other templates that you can find on the Internet, both free and commercial. You can download and install these, and give your site a completely new look. There are also a number of variations on the Water and Stone template that ship with Mambo itself.

Of course, there is no reason why you can't create your own template, or if you feel less bold, make some customizations to an existing template. We'll talk more about this in Chapter 11.