Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By : Christian Wenz, Tobias Hauser
Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By: Christian Wenz, Tobias Hauser

Overview of this book

<p>Mambo is a PHP-based Open Source CMS. Mambo is both easy to use at the entry level for creating basic websites, while having the power and flexibility to support complex web applications. <br /> <br /> Mambo implements the core requirements of a full featured CMS. It has a powerful and extensible templating system with the ability to upload and manage many different data types. User access control, content approval, rich administrative control, content display scheduling are all built-in. New features and extensions are constantly added to the core system, with many more being available and supported by the community.<br /> <br /> Most of the Mambo development team now works on a fork of Mambo known as Joomla. Mastering Mambo is fully compatible with Joomla's 1.0 release.</p>
Table of Contents (18 chapters)
Mastering Mambo
Credits
About the Authors
Preface
Index

Administration Interface


By default, the administration interface is in the administrator directory under the Mambo path. With a local installation this is, for example:

http://localhost/mambo/administrator/

With a web server installation, it often looks like this:

http://www.domain.tld/administrator/

If you call up that directory, the Mambo login mask appears (index.php). It displays the Mambo version and license and copyright.

Figure 1.5: Logging in

When you start Mambo for the first time, you use the standard user admin with the password that was set at the installation. When you add additional users later, you can, of course, log in using a different user name.

Note

Administrator Path

The path to the administration interface can only be changed in a very, very cumbersome fashion. You could potentially rename the administrator directory, but you would have to search for the all of the references to that directory. Since the administrator directory is the only place in which that path is located in absolute form, this is not simple and therefore not recommended.

Mambo's administration interface has somewhat higher browser requirements than the Mambo front ends. To be precise, the front-end browser requirements depend on the HTML and CSS used in your template. So if you use a classical layout with tables, even the problem browser Netscape 4.x can do something with that.

The administration interface, on the other hand, has to track the user on the basis of sessions and accordingly, convey the information by means of a cookie. This means that cookies have to be enabled in the browser. It is equally necessary that JavaScript is activated. The JavaScript is checked for at login and, should it be missing, is mentioned by means of a message box.

Ancient or problematic browsers such as Netscape Navigator 4.x or the older versions of Internet Explorer are difficult to deal with. Newer browsers such as Internet Explorer 6, Mozilla's Firefox, and others such as Opera and Konqueror function well even with complex applications such as the HTML editor integrated in CMS.

Note

You should exercise caution when you are installing new modules, Mambots, and components. These can have installation requirements different from Mambo.

Figure 1.6: Messed up Mambo—Netscape 4.x doesn't work with Mambo's back end

Start Page and Control Elements

Once you are logged in, you will see a lot of icons. Mambo is equipped—and this is good news—with great icons. The whole interface is actually laid out very clearly.

Figure 1.7: The start page of the administration interface

Let us first take a closer look at some of the most important areas of the interface.

Workspace

The Workspace is made up of two sections on the index page: the quick view with the lists and the Control Panel. On other pages you will find all kinds of possible settings.

Quick View

The quick view tab gives a status update about important information and is meant mainly for the system administrator:

  • Logged: This gives details about the currently logged in users. As super administrator, you can log out individual users, including yourself, by clicking on the red cross. If several users are logged in, the results may be spread over several pages. The MOS Pagination Mambot used for the pagination of the content is responsible for this internally. You have a choice as to how many results are displayed at the same time, and you can switch between the individual lists.

  • Components: This lets you quickly change the components.

  • Popular: This is a very interesting list and contains some of the most often accessed Mambo content elements. The creation date and the number of hits are displayed as additional information.

  • Latest Items: This shows the most recent content elements with associated date and name of the creator.

  • Menu Stats: This lets you know how many entries are in which menu. Thus, if an element is not published, it does not appear in the statistics.

Control Panel

The control panel displays icons for the most important Mambo tasks. The tasks are organized in so-called managers—this is Mambo's special nomenclature. You can find all of the managers in the menu and, of course, in the course of this book.

Table 1.1: The elements in the control panel

Icon

Title

Description

Help

Link to Mambo's online help.

All Content Items

Content manager.

Static Content

Administers static content. This refers mostly to content like masthead, which isn't changed too often.

Frontpage Manager

Administers all elements that are to be displayed on the homepage or start page.

Section Manager

Content in Mambo is organized as sections and sections, in turn, are organized as categories. The section manager administers sections.

Category Manager

The category manager administers the content categories.

Media Manager

The media manager makes it possible to upload pictures and documents in other formats like videos or PDFs to your site.

The media files are located in the images/stories folder. You can also create subfolders in this folder.

Trash Manager

Mambo comes with a convenient waste-paper basket, similar to current operating systems. When you delete a content element, a section, category, or other similar item, it is dumped into the waste-paper basket. You can remove these items from your system by deleting them there.

Menu Manager

Mambo administers the four default menus that come with the system in the menu. You can modify menu entries here and set them to be visible or hidden.

User Manager

In the User Manager, the administrator is concerned with users. For instance, the administrator can assign users to particular roles, such as editors. Mambo also uses the User Manager to control access to restricted areas of the site.

Global Configuration

All the necessary settings for the website are present in Global Configuration. This includes everything including the basic messages, search engine optimization, and caching.

Menu

The menu contains all of the functions of the Mambo administration interface. Whenever we discuss a particular functionality in this book, we always include the menu path. Here is an example: If you want to see the result of a setting in preview, select the Site menu and from there, the Preview entry. As you can see, it has sub-entries. In order to open the website in a new window, click on In New Window. In short, the menu command reads Site | Preview | In New Window.

Figure 1.8: 'Site | Preview | In New Window' menu command

The menu is, however, faded out when you are editing a content entry, user, or other similar data. The reason is simple: When such an element is being edited, it is locked so that only one user at a time can make changes to it. If two users were to edit the same content at the same time, the edits of at least one of these users would be lost. If an element is locked, the user working on it should not just disappear into another Mambo menu area, since the element would stay checked-out. To make sure this does not happen, the menu bar is faded out.

Note

Unlock Everything

If you want to unlock locked elements, go to System | Global Checkin. With it, all elements are checked in again. This command is very practical, but requires administrator rights.

Figure 1.9: Unlock locked content elements

Path

The path (info bar) in the form field on the left above, under the menu, always shows where you are in Mambo. Mambo does not use categories for that like, say, Yahoo!, but displays the respective component that is responsible for the current page. For example, if you are in the editing content area, you will see com_content displayed there. If you were creating a new content element, the path shown would be com_content/new. The first entry is always the title of the website—in our case The Home of Mambo—and it takes you back to the start page of the administration interface with a single mouse-click.

Note

Note that when you edit an element—content, menu entry, or user—that element is logged-out for all other Mambo administrators. However, the path remains visible. This means that you can go back to the start page of the administration interface at any time, even though the element is still logged-out.

Status Indication

The status indication on the top right is specifically meant for the currently logged in user. The left icon ( ) shows whether the user has received any new messages; unread messages are displayed in red, read messages are no longer counted. Mambo has a simple internal communication network with which, for example, an administrator can inform an editor about any improvements. The ( ) icon next to the messages icon shows the number of users who are actually logged in.

Tool Bar

The tool bar only displays a single element on the start page, the Help icon. There are a lot more elements on sub-pages, especially if you are editing elements such as content or users. Table 1.2 gives you an overview of these icons. By default, the icons are displayed in grey; if you roll your mouse cursor over them, they appear colored.

Table 1.2: Mambo Icons

Icon

Title

Description

New

Allows you to create a new element. This could be a content element, a menu entry, a user, a message, and much more.

Edit

Modifies the selected element. The type of modification that can be done, of course, depends on the type of element. For instance, content is opened with the online editor; a user is opened in a form with the user settings.

Publish

Publishes an element on the website, meaning that it is now visible. The currently selected elements are always the ones that are published. In some components this icon has a different meaning: In the mass mail component it means Send Mail.

Unpublish

Removes an element, such as content or a menu entry, from the website, but doesn't delete it. This always affects the currently selected elements.

Move

Relocates one or several elements into a different category.

Copy

Copies one or several selected elements. You can determine where the elements are to be copied to. The elements retain their names, even when they are copied into the same category as the originals, but they get a new ID.

Archive

Lets you move elements directly to the archive. These elements then disappear from the normal content and menu. Content can also be set to expire on a particular date and time and be moved automatically into the archive.

Unarchive

Reactivates one or several selected elements from the archive and puts them back to their original position. Note that these elements will not be published automatically after reactivation, even if they were previously published.

Trash/Delete/Uninstall

Erases the selected element(s) and moves them to the trash basket. The same icon can be used to remove them permanently from the trash basket. For modules, components, and Mambots, this icon means Uninstallation.

Restore

Restores an element to its original location from the trash basket.

Preview

Displays a preview of an element. By default, this is done in a new window and the preview also works for non-published elements so that the editor can test his/her results.

Upload

Opens a window, in which a file can be selected and uploaded. By default, the file format is limited to .gif, .png, .jpg (the three web graphic formats), .bmp (picture format), .swf (Flash), .doc (MS Word), .xls (MS Excel) and .ppt (PowerPoint). Pictures can be stored in the images/stories/ directory, other documents in media.

Save

Stores the changes made to an element while editing in the database and quits the Edit mode. It then puts you back as the superordinated manager. Note that this may not necessarily be the manager that you logged in as previously. With messages, this icon means send or mail.

Apply

Saves the changes for an element that were made in Edit mode, but remains in Edit mode. This means that you can change other settings. This icon is useful for testing.

Close/Force Logout

Closes the Edit mode without saving any of the changes in the database. It then puts you back as the superordinated manager. Note that this may not necessarily be the manager that you logged in as previously.

In User Administration, this icon is called Force Logout and removes a logged in user from the system.

Assign

Allocates the template to be applied in the template manager.

Default

Selects a template to be a standard element.

Edit HTML

Opens a page for editing the HTML code of a template.

Edit CSS

Opens a page for editing the CSS file of a template.

Help

Contains the link to online help.

When it comes to the icons in the tool bar, it is important to understand that Mambo has two work modes—a superordinate one for all managers in list format, and an editing mode for individual elements. The first enables you to create new elements, to copy them, and much more. In the Edit mode, a particular element is locked by Mambo and edited without the menu bar being visible. The work in the manager in list format is described in the Editing Lists section, the Edit mode in the Editing Elements section.

Many of the icons from the tool bar require that one or more elements are selected, else a JavaScript-generated error message appears. Selection of the elements arranged in list format is done with the control boxes on the left of the elements. If you click on the control box next to the table heading title, all elements are selected. A second click unselects all of the control boxes.

If you are already in Edit mode, you don't have to select anything else in order to work on an individual element. All commands are immediately applied to this element.

Editing Lists (Manager)

In principle, there are only two kinds of pages in the Mambo administration interface: List-oriented ones, which administer several elements at one time, and pages that administer individual elements. Even the Media Manager is a list, only that it has a different way of displaying it. The biggest difference consists of the fact that pages for individual Mambo elements are logged-out or locked.

This section, however, deals with the editing of lists. Here you will learn the fundamental functions and receive some tips. Editing content is a good example since it covers all the important functions. Some of the other lists contain fewer functions. This list can be found under Content | All Content Items or directly from the index page by means of the All Content Items icon on the Control Panel.

Figure 1.10: The list with the content elements

The tool bar changes from list to list, depending upon functionality of the manager. Table 1.2 gives you an overview of the various icons; these icons will help you to familiarize yourself with Mambo very quickly.

As in the case of content elements, you can sort the results with some lists too. A number of default options are available for the sorting. The possible values for these options are available in a menu. One of these, for example, is the News value in the Select Section option that displays all the content saved in the News section. Another option is a free text filter; with it, you can specify a portion of the title of an element. In order for the filter to work, you have to exit the text field or press the Enter key (Mambo implements this with JavaScript and the onBlur event handler). If you want to cancel the free text filter later on, delete the text field and exit.

Figure 1.11: Filtered content

As your website grows, the amount of content, as well as the number of users will naturally continue to increase and the lists will grow accordingly. For that reason, Mambo uses pagination for lists, meaning that the results will get distributed over several pages, starting from a set threshold. The MOS Pagination Mambot is responsible for that internally.

You can decide in a menu below the table as to how many elements you want displayed on a page. The standard setting for the length of a list is ten; you can change that to anywhere from five to fifty. On the right, next to the list of choices, you can see the number of elements (Results) and the number of elements that are currently displayed. With the links above the list of choices for the length of the list, you can maneuver back and forth between the individual pages.

Global List Length

You can set the standard list length in the Global Configuration (Site | Global Configuration) page. You will set the appropriate list length setting on the List Length: field in the Site tab.

Depending on the type of list, you will sometimes find a legend for the icons used in the list below the list length. With some managers, there are also hints displayed on the right above the list.

Now to the actual table: Depending on the type of list, it can look completely different. Mind you, with all these differences, there are also a lot of similarities—the first column shows the position of the respective element in the list, then there is a column where you can select the element or elements that you want to work on. If only one element can be selected, as is the case with the Menu Manager, radio buttons are displayed instead of checkboxes. The title or name of the element comes next. It is clickable and if you click on it, the element opens in Edit mode.

Icons in the table are generally also clickable. They either switch a function on and off (for example, whether the content is to be published or not) or refer to additional settings (say, for the menu elements). You can change the position of the element in the list with the arrow icon (Reorder). This is especially useful in case of elements for which the sequence of display is important. If you roll the mouse cursor over an icon, you get Quickinfo. Mambo executes this either with the title or alt attribute of a picture or by means of JavaScript and < div> layer. The < div> layer is used if more than a few words of information are required.

Figure 1.12: Left: Quickinfo per graphic file; Right: Quickinfo per JavaScript

Editing Elements (Edit Mode)

There are many different ways to get to the Edit mode:

  • Click on the title of an element in the list of the manager.

  • Click on the title of an element in quick view, for example, in the Logged or Popular lists.

  • Select an element and click Edit in the toolbar.

  • Create a new element with the New icon in the toolbar.

  • Use a command or an icon that puts you automatically in Edit mode (for example, Site | Global Configuration)

Figure 1.13: Editing a content item

You can recognize Edit mode by the fact that the menu bar disappears. As already mentioned above, you should then avoid any navigation within the administration interface, be it by means of the path or by using browser navigation (Back button), or the appropriate content element will stay locked. In order to unlock the locked element, you have to either go back to the element and use the save or cancel command or invoke the System | Global Checkin command. You can only use the latter if you have the appropriate rights.

Depending on the type of element, the page can look completely different in Edit mode. For content elements, two online editors and a tab appear as you can see in Figure 1.13.

Users, on the other hand, can be administered in a much simpler form as you can see in Figure 1.14.

Figure 1.14: Fewer settings required for user administration

Preview

While working with Mambo day in and day out, one quickly gets used to certain work habits. A practical one is to always have one browser window open with the administration interface and one with the front end. This is a quick way to see the changes you have made.

Mambo offers two types of previews for these purposes:

  • The preview in Edit mode displays a content element or something similar in a new window. It is suitable for a fast check, does not, however, reveal the complete page.

  • A preview of the complete page is executed with the Site | Preview menu command.

Take a closer look at the three menu commands for the preview of complete pages. Selecting the New Window option calls up the homepage of the website in a new window. In practice, it is faster if you have already opened the front end in a browser window, because changes that you have made in Edit mode can be examined immediately.

The second, Inline, option opens the page in a window section. You can navigate normally and if you want to exit the administration interface, you simply click the Open in new window link on the top right of the page. The effect is then just like with In New Window.

Figure 1.15: The preview can optionally be opened in a new window

The third, Inline with Positions, option shows the positions on the Mambo page as boxes with frameworks and titles. Thus you can see very clearly how a template is built.

Since navigation is tucked into one of these positions, this preview cannot be navigated. If you click on a link in the content area, the display of the positions disappears.

Figure 1.16: Preview with positions

Position-Preview for Every Page

Mambo creates the practical preview of the positions by attaching the tp=1 parameter to the URL. That means that you can also use this preview for sites other than your own Mambo site. How would you, for instance, like to see the positions in the template of the official Mambo site http://www.mamboserver.com/? Simply call up http://www.mamboserver.com/index.php?tp=1. If you don't want to betray this information for your own site, open the frontpage.php file in the includes directory. Search for the following lines and comment them out (with /* at the beginning of the line and with */ at the end):

$tp = mosGetParam( $_GET, 'tp', 0 );
if ($tp) {
  echo '<div style="height:50px;background-color:#eee;margin:2px;
padding:10px;border:1px solid #f00;color:#700;">';
  echo $position;
  echo '</div>';
  return;
}

Logging Out

Once you have finished the work in the administration area, you can log yourself out with the Logout link on the top right (logout.php). If you simply close the browser, you are still logged in. Mambo terminates the session after a certain time interval. You can specify the length of this time interval in the Login Session Lifetime under the Server tab in Site | Global Configuration. Mambo uses its own data and not PHP's session management utility or the session run time from the php.ini configuration file to do this.

Note

Note that you will be logged out automatically at the end of the session time if you do nothing and don't navigate anywhere within Mambo. This also happens if the page with the administration interface remains open. It could be really annoying if you have made extensive changes to the open page without saving or navigating within Mambo and your session expires. If this happens, you are automatically shuffled to the Login page and your data is lost. By logging in again, you end up on the index page again.

It now becomes apparent that Mambo is no Windows program, but a web application. The technological foundation for this principle is the HTTP (Hyper Text Transfer Protocol) web protocol. An HTTP connection consists of a request from the 'Client' (the browser) to the web server and the response of the server. Every click on a link or the transmission of a form is a request. The web server only understands that the client is being worked on when it receives a request. The server only stores values when the page or the HTML form is transferred to the server or when a new page is requested.