XUpload - Displaying the email variables with labels

Message
Author
jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

Displaying the email variables with labels

#1 Postby jimrws » Jun 02, 2008 3:00 pm

Hi,

Currently in the email template, the 'other form variables' appear together in a big chunk and use the variable name as a label for the value. These other variables just appear from a loop and there's no way to break them up and use them individually.

I'd like to be able to specify these variables and display them next to my own labels, or mix the variables with my own text.

In the past I have done something like this in php quite easily. But I don't know Perl at all so not sure how to do this for Xupload:

Code: Select all

This is how it is at the moment:
<varible name> : <variable value>
<varible name> : <variable value>
<varible name> : <variable value>

This is an example of the kind of thing I need:
"Hello" <variable value> Your address is : <variable value>

In php I would normally use something like:
<?php echo "Hello" .$_POST("Name"). "Your address is" .$_POST("Address"); ?>

How do I do this in Xupload?
Thanks for any help.

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Jun 03, 2008 10:45 am

What XUpload version?

jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

#3 Postby jimrws » Jun 03, 2008 10:48 am

XUpload Pro 3.0

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Jun 03, 2008 11:10 am

in upload.cgi find

Code: Select all

$tmpl->param('files'     => \@files,
and add above it:

Code: Select all

my %hh; $hh{$_->{name}}=$_->{value} for @har;
then add below it:

Code: Select all

%hh,

Now you can use in your email template tags like

Code: Select all

<TMPL_VAR ip>
using names of custom variables in tags.

jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

#5 Postby jimrws » Jun 03, 2008 1:27 pm

EDIT: I got it working now. This is the full block of code for anyone interested.

Code: Select all

my @t = &getTime;
   my $tmpl = HTML::Template->new( filename => "Templates/confirm_email.html", die_on_bad_params => 0 );
   my %hh; $hh{$_->{name}}=$_->{value} for @har;
   $tmpl->param('files'     => \@files,%hh,
                'params'    => \@har,
                'time'      => "$t[0]-$t[1]-$t[2] $t[3]:$t[4]:$t[5]",
                'total_size'=> "$ENV{CONTENT_LENGTH} bytes",
                'total_size_mb' => sprintf("%.1f",$ENV{CONTENT_LENGTH}/1048576)." Mb",
               );
   my $subject = $c->{email_subject} || "XUpload: New file(s) uploaded";
Thanks for the help Pilgrim