Changeset 1966
- Timestamp:
- 2001-02-13T15:52:08+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/macros/yourhome.dm
r1550 r1966 2 2 _content_ { 3 3 4 <h2> How to make your own Greenstone home page</h2>4 <h2>Your own Greenstone home page</h2> 5 5 6 <h3>Question</h3>7 <ul>8 How can you specify a different opening page for Greenstone? Does it9 work with the Local Library? Does it work if I put the collection onto10 CD-ROM? Can I have other links in it?11 </ul>12 13 <h3>Answer</h3>14 <ul>15 It's easy! And the answers to the other questions are yes, yes, yes.16 </ul>17 18 <h3>Example</h3>19 6 <ul> 20 7 <table> 21 <tr align=left><th>Where to go</th><th>Incantation</th><th>Check this!</th> 22 <tr valign=top><td>Search page for the demo collection<br>(Replace "demo" by your collection name)</td> 23 <td>\_httpquery\_&c=demo</td> 8 <tr valign=top><td>Search page for the demo collection<br></td> 24 9 <td><a href="_httpquery_&c=demo">Click here</a></td></tr> 25 10 26 11 <tr><td>"About" page for the demo collection</td> 27 <td>\_httppageabout\_&c=demo</td>28 12 <td><a href="_httppageabout_&c=demo">Click here</a></td></tr> 29 13 30 14 <tr><td>Preferences page for the demo collection</td> 31 <td>\_httppagepref\_&c=demo</td>32 15 <td><a href="_httppagepref_&c=demo">Click here</a></td></tr> 33 16 34 17 <tr><td>Home page</td> 35 <td>\_httppagehome\_</td>36 18 <td><a href="_httppagehome_">Click here</a></td></tr> 37 19 38 20 <tr><td>Help page</td> 39 <td>\_httppagehelp\_</td>40 21 <td><a href="_httppagehelp_">Click here</a></td></tr> 41 22 42 23 <tr><td>Administration page</td> 43 <td>\_httppagestatus\_</td>44 24 <td><a href="_httppagestatus_">Click here</a></td></tr> 45 25 46 26 <tr><td>The Collector</td> 47 <td>\_httppagecollector\_</td>48 27 <td><a href="_httppagecollector_">Click here</a></td></tr> 49 28 … … 51 30 </ul> 52 31 53 <h3>How to do it</h3>54 <ul>55 <p>What generates the Greenstone home page is in the file home.dm.56 It's actually the thing called "package home" that is defined in that file.57 You could edit this file, or create a new file that defined "package58 home" in a different way.59 60 <p>When you make a different opening page, you have to have some way of61 linking in to the Greenstone pages. The solution that we adopt is to use62 "macros". That's why the home-page file is called ".dm"63 and not ".html" -- it's a "macro" file rather than a regular html file.64 But don't quail: the macro file basically contains just html, sprinkled65 with a few mystical incantantations.66 67 <p>The best way to see is with an example. So this file is an example!68 The text you are reading is in a file called yourhome.dm, and it's a69 template for creating your own specialized Greenstone home page. Replace70 this text with your own to create a home page tailored to your own needs.71 The text is regular html; you can include links and all the other stuff72 that html provides.73 74 <p>Most of this file just the html that is used to create this page. To75 link in with other Greenstone pages, use the appropriate magic spell76 (surrounded by underscores) -- such as \_httppagehome\_, \_httppagehelp\_,77 \_httppagepref\_, etc.78 </ul>79 80 <h3>How to make it work</h3>81 <ul>82 83 <p>You have to tell Greenstone about the new home page yourhome.dm.84 Greenstone reads in the macro files that are specified in the main85 configuration file main.cfg, so if you create a new one you must include it86 there. Name clashes are handled sensibly (most recent definition takes87 precedence), and reported in an error log on startup.88 89 <p>Thus to make the Greenstone digital library software use this home page90 instead of the default, first put this file into the appropriate place,91 which is $GSDLHOME$gsdl/macros/yourhome.dm. Then edit the92 gsdl/etc/main.cfg configuration file to replace the home.dm macro file with93 yourhome.dm in the list of macro files that are loaded at startup.94 </ul>95 96 <h3>Advanced stuff</h3>97 <ul>98 99 <p>The other macros in this file (\_httppagehome\_, \_httppagehelp\_,100 \_httppagepref\_, etc.) are defined in the base macro file base.dm.101 102 <p>With the \_httpquery\_, \_httppageabout\_ and \_httppagepref\_ macros,103 you need to append an extra argument naming the collection you require104 (&c=collectionname). Check base.dm for the definition of these macros105 106 <p>The whole of the current file, yourhome.dm, is defined as the body of107 the \_content\_ macro of the "home" package -- that is what the very first108 and last lines of this file do.109 110 <p>This macro definition (\_content\_) is just plain html. Any standard111 html code may be placed within a macro definition. However, the special112 characters '\{', '\}', '\\', and '\_' must be escaped with a backslash to113 prevent them from being processed by the macro language interpreter.114 115 <p>As you can see if you look at the file, the \_content\_ macro definition116 does not contain any html header or footer. If you want to change the html117 within the header or footer of your home page you may define a \_header\_118 and a \_footer\_ macro. Defining a new macro is a simple case of adding it119 to the yourhome.dm macro file in the form120 121 <p><ul>\_macroname\_ \{122 <ul>...</ul>123 \}124 </ul>125 126 <p>where \_macroname\_ is \_header\_, \_footer\_ etc.127 </ul>128 129 <h3>Really advanced stuff</h3>130 <ul>131 132 <p>You may be surprised to find example that \_httpquery\_ is not used in133 home.dm. The reason is that the list of collection names is generated134 dynamically (by a C++ function) to reflect the collections that are present135 on your system. The \_homeextra\_ macro in home.dm is where this is136 invoked. Of course, in your application you will know the collection name,137 so you can use the appropriate &c=... argument -- just as we have used138 "demo" in this file.139 140 </ul>141 32 } 142 33 … … 146 37 # _header_ { 147 38 # } 148 149
Note:
See TracChangeset
for help on using the changeset viewer.