Hi Andrew,
there are several ways of doing this.
A. using global variables in the sitemap
B. setting the value in your session with for instance the setteraction.
C. Using the defaults module in the cocoon.xconf
I think there is enough information on the setter action in the archives
[1], so i'll try to explain the other methods. (A and C)
A. defining the value in the sitemap
<map:pipelines>
<map:component-configurations>
<global-variables>
<smtphost>localhost</smtphost>
</global-variables>
</map:component-configurations>
</map:pipelines>
and passing the value as a sitemap parameter to your flowscript function.
<map:match pattern="function">
<map:call function="test">
<map:parameter name="smtp" value="{global:smtphost}"/>
</map:call>
</map:match>
and in your flowscript:
var smtphost = cocoon.parameters["smtp"];
C. could specify it as a variable in the DefaultsModule (cocoon.xconf)
<component-instance
class="org.apache.cocoon.components.modules.input.DefaultsModule"
logger="core.modules.input" name="myconstants">
<values>
<smtphost>localhost</smtphost>
</values>
</component-instance>
Then in your flowscript you can request the value with:
var myConstants = cocoon.getComponent(InputModule.ROLE +
"Selector").select("myconstants");
var myObject = myConstants.getAttribute("smtphost",null,null);
I hope this helps.
Kind regards,
Jeroen Reijn
[1] http://marc.theaimsgroup.com/?l=xml-cocoon-users&r=1&w=2
Andrew Madu wrote:
Hi,
I have the following line in my flow document:
var sendEmail = SimpleEmail.send('smtp.ntlworld.com
<http://smtp.ntlworld.com>',userGlobal.getEmail(),'[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>','Your Receipt',receipt());
Instead of having to hard code the smtp address, in this case
'smtp.ntlworld.com <http://smtp.ntlworld.com>', is there a
server/environment variable that I can pull this value from within
flowscript? So my line will now look something like:
var sendEmail =
SimpleEmail.send(cocoon.getISPsmtp,userGlobal.getEmail(),'[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>','Your Receipt',receipt());
--
Regards
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]