package home _content_ {
Where to go | Incantation | Check this! |
---|---|---|
Search page for the demo collection (Replace "demo" by your collection name) |
\_httpquery\_&c=demo | Click here |
"About" page for the demo collection | \_httppageabout\_&c=demo | Click here |
Preferences page for the demo collection | \_httppagepref\_&c=demo | Click here |
Home page | \_httppagehome\_ | Click here |
Help page | \_httppagehelp\_ | Click here |
Administration page | \_httppagestatus\_ | Click here |
The Collector | \_httppagecollector\_ | Click here |
What generates the Greenstone home page is in the file home.dm. It's actually the thing called "package home" that is defined in that file. You could edit this file, or create a new file that defined "package home" in a different way.
When you make a different opening page, you have to have some way of linking in to the Greenstone pages. The solution that we adopt is to use "macros". That's why the home-page file is called ".dm" and not ".html" -- it's a "macro" file rather than a regular html file. But don't quail: the macro file basically contains just html, sprinkled with a few mystical incantantations.
The best way to see is with an example. So this file is an example! The text you are reading is in a file called yourhome.dm, and it's a template for creating your own specialized Greenstone home page. Replace this text with your own to create a home page tailored to your own needs. The text is regular html; you can include links and all the other stuff that html provides.
Most of this file just the html that is used to create this page. To link in with other Greenstone pages, use the appropriate magic spell (surrounded by underscores) -- such as \_httppagehome\_, \_httppagehelp\_, \_httppagepref\_, etc.
You have to tell Greenstone about the new home page yourhome.dm. Greenstone reads in the macro files that are specified in the main configuration file main.cfg, so if you create a new one you must include it there. Name clashes are handled sensibly (most recent definition takes precedence), and reported in an error log on startup.
Thus to make the Greenstone digital library software use this home page instead of the default, first put this file into the appropriate place, which is $GSDLHOME$gsdl/macros/yourhome.dm. Then edit the gsdl/etc/main.cfg configuration file to replace the home.dm macro file with yourhome.dm in the list of macro files that are loaded at startup.
The other macros in this file (\_httppagehome\_, \_httppagehelp\_, \_httppagepref\_, etc.) are defined in the base macro file base.dm.
With the \_httpquery\_, \_httppageabout\_ and \_httppagepref\_ macros, you need to append an extra argument naming the collection you require (&c=collectionname). Check base.dm for the definition of these macros
The whole of the current file, yourhome.dm, is defined as the body of the \_content\_ macro of the "home" package -- that is what the very first and last lines of this file do.
This macro definition (\_content\_) is just plain html. Any standard html code may be placed within a macro definition. However, the special characters '\{', '\}', '\\', and '\_' must be escaped with a backslash to prevent them from being processed by the macro language interpreter.
As you can see if you look at the file, the \_content\_ macro definition does not contain any html header or footer. If you want to change the html within the header or footer of your home page you may define a \_header\_ and a \_footer\_ macro. Defining a new macro is a simple case of adding it to the yourhome.dm macro file in the form
where \_macroname\_ is \_header\_, \_footer\_ etc.
You may be surprised to find example that \_httpquery\_ is not used in home.dm. The reason is that the list of collection names is generated dynamically (by a C++ function) to reflect the collections that are present on your system. The \_homeextra\_ macro in home.dm is where this is invoked. Of course, in your application you will know the collection name, so you can use the appropriate &c=... argument -- just as we have used "demo" in this file.