bradcathey has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monasterians,

Is it possible to open an H::T .tmpl file in a new window?

Why? I'm trying to create a "pop-up" help screen that appears over the form it is providing help for, similar to:

window.open('help.html',...)

in javascript. I want it to be a smaller fixed size. Ideas? Thanks all.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: Opening an HTML::Template page in new window
by CountOrlok (Friar) on Apr 26, 2006 at 03:19 UTC
    How about, in your parent page, calling window.open with the name of your cgi script that processes and displays the HTML::Template template file? -imran

      Perfect. Not really a Perl thing, but here's what worked:

      HTML: <a href="javascript:help('homehelp');"> <img src="../images/help.gif" alt="home" /></a> JAVASCRIPT: function help (tmpl_to_open) { window.open("http://foobar.com/instances/help?rm=sh&pg="+tmpl_to_o +pen,"optional_page_name","scrollbars=1,location=0,directories=0,statu +s=0,width=550,height=375,toolbar=0,menubar=0,resizable=0"); }

      Thanks!


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
        Hi,
        Just do 'alert' the  window.open parameter. And one more thing while setting optional parameters in the window.open function,
        "scrollbars=1,location=0,directories=0,statu +s=0,width=550,height=375,toolbar=0,menubar=0,resizable=0"

        I guess it might be like
        "scrollbars=1;location=0;directories=0;statu +s=0;width=550;height=375;toolbar=0;menubar=0;resizable=0"
        Before that, Try with some static pages and make sure that javascript is working fine. Otherwise i'm sure that you may miss some values which is dynamically passing into the  window.open function.
        Thanks.
        -kulls
Re: Opening an HTML::Template page in new window
by dorward (Curate) on Apr 26, 2006 at 07:28 UTC

    Browsers do not know about HTML::Template, and they don't need to. Perl takes an HTML::Template file and some data, puts the two together and sends the data back to the server which passes it on to the client.

    It seems that what you need to do is:

    1. Decide what you want to display to the user
    2. Decide how you want it displayed.
    3. Work out how you would write client side code to display data in the way determined in step 2 if Perl and HTML::Template were not involved.
    4. Write Perl and templates to output code that presents the data you came up with in step 1 in the format you determined in step 3.

    At the moment you seem to be on step (updated) 3, which isn't really anything to do with Perl, so this isn't the best place to be asking.

Re: Opening an HTML::Template page in new window
by Asim (Hermit) on Apr 26, 2006 at 03:24 UTC
    Ideas?

    Perhaps. Am I correct in assuming that you just want the javascript to say 'help.tmpl', instead of 'help.html'? If so, just call help.tmpl like you call any other HTML::Template file.

    If the issue is that you simply want to show a chunk of HTML in a smaller font, use CSS before employing any new H::T code, especially if you've not been using H::T up till now. Using CSS will save you tons of grief, in the long run.

    Did I hit what you needed? If I'm unclear, please reply, and let me/us know some more details about how you're thinking about implementing this.

    ----Asim, known to some as Woodrow.