Test Setup Instructions

This document will give you an overview how to setup FS-Midcom without regard to MidCOM Template; it is for a quick-and-small test setup. MidCOM Template compatible setup instructions are gladly welcome here.

Prepare Midgard

For Midgard, we need an empty sitegroup in an environment, were no Database-Driven MidCOM is available. In that Database, create an empty, and simple Website, without bells and whistles, and set the complete host to authentication. This will make basic testing easier.

Prepare MidCOM

Take the CVS Checkout, and put it somewhere in your filesystem. The lib and static folder can be distributed and named as you like. Make the static folder available under the Apache Virtual Host, using an Apache Alias directive preferrably. The content of this directory need not to be executable by the Server, only accessible. It is recommended to turn DircetoryIndexes off. Ensure, that PHP can read and execute files in the lib.

Note for Development servers

You can turn on DirectoryIndexes on the static directory, this wlil make life a bit easier when debugging missing files etc. Also, if you want to update the L10n Tables, you have to allow Apache to write to the L10n Databases (all paths with "/locale/" in them).

TODO: Example Apache Configurations

Important: Apache Alias will not work

Due to the way mod_midgard links into Apache, it is impossible to use the Alias directive to "link" the static content into MidCOMs hierarchy. The reason is, that at least for Apache 1.3.x the internal Alias handler is not invoked until Midgard has declared that it cannot handle a request.

Instead, use a Symlink to get the corresponding content into you DocumentRoot and set MidgardFavorFiles On in your Apache configuration.

Configure the Site

The following Elements need to be added/adapted.

As usual, call $midcom->codeinit() in <[code-init]> and $midcom->content() in <[content]>. Nothing has changed there.

Content Topic

Create a content topic, note its GUID and add the following Parameters to it:

This will allow easy testing.

Admin Topic

Below the content topic, add another topic and call it "admin" or something like that. It will hold the content Admin. Add these Parameters to it:

Of course, you have to fill in the correct GUIDs at that point.

L10n Editor

Optionally, you can create a third topic, lets call it l10n within the site to use the L10n editor. Add these parameters:

code-global

A rather complete code-global will look like this; the italic lines are noteworthy:

  1:   2: 
3: $midcom_roottopic = "860f1b5af98b409abd916a80cdb0d68e";
4:
5: /* You need to duplicate this settings in the AIS page, so that
6: * the content admin invalidates the correct cache.
7: */
8: # $midcom_cachedir = "/tmp/"; /* This is the default */
9: $midcom_cachehandler = "db4";
10: $midcom_cachemultilang = false;
11: $midcom_helper__cache_disable = false;
12:
13: $midcom_logfile = "/tmp/midcom-site.log";
14:
15: define ('MIDCOM_ROOT', '/home/torben/WEBSITES/midcom/lib');
15a: define ('MIDCOM_STATIC_ROOT', '/home/torben/WEBSITES/midcom/static');
16: define ('MIDCOM_STATIC_URL', '/midcom-static');
17:
18: require(MIDCOM_ROOT . '/midcom.php');
19:
20: // $midcom_debugger->setloglevel(MIDCOM_LOG_WARN);
21: $midcom_debugger->setloglevel(MIDCOM_LOG_DEBUG);
22: $midcom->cache->no_cache();
23:
24: /* Activate UTF-8 and lock the language to DE, we are no multilang
25: * site, this avoides (in conjunction with cachemultilang=false)
26: * duplicate pages in the cache.
27: */
28: $i18n =& $midcom->get_service("i18n");
29: $i18n->set_language("en");
30: $i18n->set_charset("utf-8");
31: ?>

Lines 3 and 13: Adapt this to your local Midgard Setup.

Lines 15 through 16: MIDCOM_ROOT needs to point to the directory where you have the complete MidCOM lib installed, MIDCOM_STATIC_ROOT to the static file directory, while the MIDCOM_STATIC_URL must be an URL prefix valid for the current host, that will lead you to the static files of MidCOM. Note the missing trailing slash here.

Line 18 currently replaces the classic include("midcom/midcom") statement.

Insider Trick: You can omit code-init and just put a $midcom->codeinit() in the last line of code-global.

Automatic constant detection

Given that you have a default installation (one directory with lib/ and static/ subdirectories below it, as in CVS), the midcom.php Revision 1.3 (2004-11-12, 9h) will now be able to auto-detect the correct constant paths fairly well. The static dir will be set relative to the lib-dir, while MIDCOM_STATIC_URL defaults to /midcom-static. That should get MidCOM going with a single include line like require('/usr/share/midgard/midcom/lib/midcom.php');

Style Element HEAD

You have to add the AIS CSS reference to the HTML Head of your template, Asgard's simple Style template calls this element <[head]>. Add this lines to it:

<link rel="stylesheet"
type="text/css"
media="screen"
href="<?php echo MIDCOM_STATIC_URL;
?>/midcom.admin.content/ais.css">
<?php
if (array_key_exists("view_contentmgr", $GLOBALS))
$GLOBALS["view_contentmgr"]->print_jscripts();
?>

Style Element ROOT

The Body tag has to be modified as well for full JScript support:

<BODY<?php
if (array_key_exists("view_contentmgr", $GLOBALS))
$GLOBALS["view_contentmgr"]->print_jsonload();
// <BODY ... ?>>

Fire Away

That should do it, go and access your site at the root page, and you should see an empty TAViewer Article Index, and on /admin you should have an working AIS. Note, that some relocations are broken right now, especially on HTTPS servers. This is not a FS-MidCOM Problem, but a generic MidCOM one; AIS does not yet use $midcom->relocate().