LoginRegisterCommercial SupportContact Us


ExSite Webware Forum > Comment "offline page generation"

offline page generation
by Alan Douglas, posted on 12:57 PM, April 3, 2008
I generate formatted newsletters using the ExSite page generation tools. My email system does this to get the complete message body:

my $p = new ExSite::Page(id=>$page_id);
$p->set_context();
$message = $p->expand();

That generates the default page view, but I really want to pass some special arguments in, so that a plug-in module in the page can act on them. I've gone through some of the ExSite code and documentation, but I couldn't see how to do this.

Should I do this through an environment variable? Could you tell me which one?
    Re: offline page generation
    by Morgan Burke, posted on 1:05 PM, April 3, 2008
    If your job is NOT running as part of a web request, then you can probably just set the environment variable QUERY_STRING to hold the arguments. The ExSite input management tools will pick it up from there, and the plug-in module will not know the difference.

    If your job is running as part of a web request, then the QUERY_STRING may have already been read in. In that case, you can retroactively modify the input buffers as follows:

    my $input = new ExSite::Input;
    $input->set("arg1","val1","get");
    $input->set("arg2","val2","get");

    The first 2 parameters to set() are the argument and value; the last parameter "get" means set this argument in the "GET" input stream (ie. the QUERY_STRING) only.
      Re: offline page generation
      by Alan Douglas, posted on 2:00 PM, April 3, 2008
      Morgan Burke wrote:
      If your job is NOT running as part of a web request, then you can probably just set the environment variable QUERY_STRING to hold the arguments. The ExSite input management tools will pick it up from there, and the plug-in module will not know the difference.

      Okay, this seems to work, but only for the first page I generate. When I change QUERY_STRING and make a new page, it still seems to be using the previous arguments.
        Re: offline page generation
        by Morgan Burke, posted on 2:06 PM, April 3, 2008
        Alan Douglas wrote:
        Okay, this seems to work, but only for the first page I generate. When I change QUERY_STRING and make a new page, it still seems to be using the previous arguments.

        That's because you are creating multiple pages in one perl program, which makes it look like one HTTP request. ExSite caches the input data from the first QUERY_STRING and re-uses it to be more efficient.

        To reset the input cache and force QUERY_STRING to be re-read, do this:

        delete $share{input};

        after each page.
    back back