[greenstone-users] style.dm and extra.dm

From Michael Silver
DateTue Feb 15 18:40:31 2011
Subject [greenstone-users] style.dm and extra.dm
In-Reply-To (AANLkTikuRFHzE-mGhkfFfCdA-CDWV1y-WHY1c0pFHMK5-mail-gmail-com)
I may not be using the correct terminology, but the way I understand it
is that the collection-specific extra.dm file overrides the values used
in the site-wide macro files. For Greenstone to know which file is being
overridden, you have to declare it in the extra.dm file before the
change you make. The package statement which declares this is in control
until another package statement or until the end of the extra.dm file,
whichever comes first. That's how the single extra.dm file is able to
override the various macros at the site level. I'm not sure that makes
as much sense as it did in my head ...

Let's say I want to create custom macros in the style of pages, the help
pages and the about pages. Using the basic list of packages in [1], I
would do something like:

# Modify collection style settings
package Style

... various macros ...

# end of package Style

# modify help page for collection
package help

... various macros ...

# end package help

# Modify the collection's about page
package about

... various macros ...

# end package about

In the example above, the hash symbol (#) indicates a comment.
Greenstone ignores the line, which means I can make notes to myself. I
can also try changes by coping a macro, commenting out the old one (in
case I need to revert), and modifying the new one.

It's important to pay attention to the package statements, especially if
your extra.dm file is long and/or involved. It's easy to accidentally
break your customizations by inserting your macros in the wrong place
and ending up with them in the wrong package section. I usually make
heavy use of comments to clearly mark where the beginning and end of
packages. This is important to me since there is no closing statement to
match with the opening package statement. Again, the comments in the
example above help with that.

Take a look at
[0] http://www.wrlc.org/dcpc/UserInterface/interface.htm
[1] http://wiki.greenstone.org/wiki/index.php/Customizing_collections

For even more in-depth information, I highly recommend the tutorial
session materials available from the Greenstone website at [2]
http://www.greenstone.org/download. I found an example on page 85 of the
workshop book from the May 2009 4-day workshop. In general, I find the
examples, etc. from the various tutorial sets on that page very, very
useful!

I hope this helps,
Michael
[0] http://www.wrlc.org/dcpc/UserInterface/interface.htm
[1] http://wiki.greenstone.org/wiki/index.php/Customizing_collections
[2] http://www.greenstone.org/download

On 14/02/2011 9:09 PM, Sean Mitchuson wrote:
> I'm afraid I don't understand what you mean by package Style. I
> haven't seen any of that listed in any of the documentation I've read
> about editing the extra.dm file so I'm curious about it. This could
> be the solution to my problem.
>
> On Mon, Feb 14, 2011 at 5:48 PM, Michael Silver<msilver@farpan.net> wrote:
>> This may be a bit basic, but if you are re-defining for collection specific
>> uses, the entry in extra.dm has to include the package. Your example doesn't
>> show the package declaration. Does your extra.dm file contain
>>
>> package Style
>>
>> {
>> <style type="text/css">
>> body.bgimage { background: url("/gsdl/web/images/flood1937.jpg") left top;
>> background-repeat:no-repeat; }
>> </style>
>> }
>>
>> Another possibility - have you changed the definition of /gsdl/web/images to
>> somewhere else? I usually have put the image in a collection-specific path,
>> and then put the full path in the extra.dm file.
>>
>> I know these are rather basic suggestions, but ...
>>
>> Good luck!
>>
>> Michael
>>
>>
>>
>> On 14/02/2011 1:19 PM, Sean Mitchuson wrote:
>>> I wanted to send this again because the other one didn't seem to load
>>> right so I'm again.
>>>
>>> I have body.bgimage defined in the style.dm file and it works great.
>>> I want to be able to use extra.dm in specific collections to override
>>> this but for some reason I can't. Is there something I need to switch
>>> on to tell a collection to use the extra.dm file?
>>>
>>> What is the exact code I need to use for extra.dm to set a proper
>>> bgimage in there right now i'm using.
>>>
>>> {
>>> <style type="text/css">
>>> body.bgimage { background: url("/gsdl/web/images/flood1937.jpg") left
>>> top; background-repeat:no-repeat; }
>>>
>>> </style>
>>> }
>>>
>>> But this do not work for me.
>>>
>>> Any help would be appricated.
>>>
>>> --
>>> Sean Mitchuson
>>> Library Tech Coordinator
>>> Murray State University
>>> Murray, Ky
>>> Phone: 270.809.4773
>>>
>>> _______________________________________________
>>> greenstone-users mailing list
>>> greenstone-users@list.scms.waikato.ac.nz
>>> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>>
>> _______________________________________________
>> greenstone-users mailing list
>> greenstone-users@list.scms.waikato.ac.nz
>> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>>
>
>