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
Posted on Apr 3, 2008, by Morgan Burke
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
Posted on Apr 3, 2008, by Alan Douglas
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 Xonly 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
Posted on Apr 3, 2008, by Morgan Burke
Alan Douglas wrote:
Okay, this seems to work, but Xonly 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 Xone perl program, which makes it look like Xone 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:
Support > ExSite Webware Forum > offline page generation
offline page generation
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
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
Morgan Burke wrote:
Okay, this seems to work, but Xonly 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
Alan Douglas wrote:
That's because you are creating multiple pages in Xone perl program, which makes it look like Xone 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.