Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


pls help

  • Prabhat kumar
    Prabhat kumar

    hi friend

    can anybody tell me that which macro i have to use for print my hostname in greestone.

    i.e. localhost or ip

  • ak19

    Hi Prabhat,

    I am not aware of a macro to do that, but you could try using javascript. The Location object in javascript gives you access to the hostname or IP parts of a URL you're on. See w3schools.com/jsref/obj_location.asp

    Now, go to the "macros" folder of your Greenstone installation find the macro file (extension .dm) from where you want the hostname displayed. Into this macro file, add in the Javascript code that will refer to the Location object's hostname for displaying it. See the Greenstone tutorial at wiki.greenstone.org/wiki/gsdoc/tutorial/en/using_macro_files.htm to learn a little about Greenstone's macro files and how to insert lines to get them to display on each page and how to determine which macro file to edit.

    Finally, note that if you want to use javascript code in macro (.dm) files, you may need to escape some characters like curly braces. To see how this is done, inspect a file like macros/query.dm where javascript functions are declared and used. You will want to write any javascript functions in the same way into the macro file you choose.