Gossamer Forum
Home : General : Perl Programming :

Adding Line Break

Quote Reply
Adding Line Break
Hi All

I am trying to add a line break in some custom input that I receive from my customers. I make dog tags (surprise!), and my customers send me their data through my form.

Right now, the output on the invoices (mine and my customer's) looks like this:

In Reply To:
[TEXT OPTIONS: LINE1=Fred Smith, LINE2=Address, LINE3=City, LINE4=State, LINE5=Zip]
What I'm trying to do is have it look like this:

In Reply To:
[TEXT OPTIONS:
LINE1=Fred Smith
LINE2=Address
LINE3=City
LINE4=State
LINE5=Zip
]
The reason is that if the customer's data gets split at the end of the line while printing, then I can't tell whether they have a space in their string:

12345 67890
1234567890

Here is the part of the script that I believe controls the output:

In Reply To:
if (@textadd){
$i=0;
$cartline_string .= $USERCUSTOM{'START_OPTIONS'} . $USERCUSTOM{'TEXT_OPTIONS_DISPLAY_TEXT'};
foreach $texts (@textadd){
my($textfor, $thetext, $textprice) = split (/\^/,$texts);
$i++;
$WEBDAT{'price'} += $textprice;
$cartline_string .= " $textfor\=$thetext";
if($textprice){
$cartline_string .= sprintf(" for $money_sign%.2f",$textprice)if(!$USERCUSTOM{'HIDE_OPTION_FEES'});
$add_fees =1;
}

$cartline_string .= ', 'if($i<@textadd);
}
$cartline_string .= $USERCUSTOM{'END_OPTIONS'};
$i=0;
}
I found this thread:

http://www.gossamer-threads.com/...ew=&sb=&vc=1

I know that if I have a "print" line of code like the following, I just have to add the break at the end with "\n" (without the quotes).

In Reply To:
print &get_file_as_iostring('checkoutheader.html')\n;
But, if it's not a "print" line, I am not sure what to add to get the break.

If anyone might know if a line break can be added, I would be very grateful.

As always, thanks for your help. Smile

DT

Quote Reply
Re: Adding Line Break In reply to
Okay, I figured it out. You don't need a PRINT thingy to make this work. The main thing I had to do was add a break in the cartline_string thing, then fool around with another config file. I've highlighted the primary change below (don't include the spaces in the break code-I could't get it to show up in the forum without spreading out the characters):

In Reply To:
if (@textadd){
$i=0;
$cartline_string .= $USERCUSTOM{'START_OPTIONS'} . $USERCUSTOM{'TEXT_OPTIONS_DISPLAY_TEXT'};
foreach $texts (@textadd){
my($textfor, $thetext, $textprice) = split (/\^/,$texts);
$i++;
$WEBDAT{'price'} += $textprice;
$cartline_string .= "< br > $textfor\=$thetext";
if($textprice){
$cartline_string .= sprintf(" for $money_sign%.2f",$textprice)if(!$USERCUSTOM{'HIDE_OPTION_FEES'});
$add_fees =1;
}

$cartline_string .= ', 'if($i<@textadd);
}
$cartline_string .= $USERCUSTOM{'END_OPTIONS'};
$i=0;
}
HTH SmileSmile

DT