Gossamer Forum
Home : Products : DBMan : Customization :

This may be easy

Quote Reply
This may be easy
Hi Everyone,

I am using the forward record mod and have it programmed to have it send out the record in html. The problem I am having is that when the record is received by email all the field categories are bunched up next to each other like this;

ID: 87 Category: Job Vacancies Region: ACT Title: test Description: This is where the description goes Closing Date: 06-May-2003 Date Published: 06-May-2003

as opposed to being in a column like this

ID: 87
Category: Job Vacancies
Region: ACT
Title: test
Description: This is where the description goes
Closing Date: 06-May-2003
Date Published: 06-May-2003


Does anyone know how to change this?

Thanks for any suggestions!

-Dave
Quote Reply
Re: [daverad] This may be easy In reply to
To quote another thread:

Thread: http://gossamer-threads.com/p/89208
Subject: modify result mod:email forward
Marcel Emmen - 21-Jun-00
==============

You can set the definiton of $in{'email_message'} to be anything you want. Just like in sub html_record, use $rec{'FieldName'} type variables.

For example, you could use something like this

$in{'email_message'} = qq|
Hi, there.

I just wanted you to know that $rec{'FirstName'} $rec{'LastName'} has a record in the $html_title database
that I think is really cool. Did you know that $rec{'FirstName'} lives in $rec{'City'}? I have always wanted
to visit $rec{'Country'}, especially $rec{'City'}. Maybe we should get together at $rec{'FirstName'}'s house
at $rec{'Address'} and we can all study Perl together.

=======

Another example which would be in the format you want to use:

$mailtext = qq|You have requested this thread reference be sent to you from $site_title.\n
$rec{'Title'}
$rec{'Title2'}
$rec{'Category'}\n
$rec{'Summary'}\n
Thread:
$rec{'text'}\n\n
Topic: $rec{'gt_topic'}
Posted by:$rec{'postedby'}   $rec{'gt_date'}
Thread reference: $gturl$rec{'gt_ref'}\n\n
- - - - - - - - - - - \n
You can find many more thread references by visiting $site_title at $site_url
|;

Line breaks are created either by just entering one per line or to create more spaces you can use \n at the end of the line(s)

Hope this helps

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] This may be easy In reply to
Hi Lois,

Thanks for taking the time to look at this problem. I tried changing the code but I couldn't make it work (I am not a programmer). Your answer inspired me to look at the code again which allowed me to come up with a solution!

I changed the beginning of the sub html_forward_email_form in html.pl from



sub html_forward_email_form {
#----------------------------------------------------------
my ($message) = $_[0];
$in{$db_key} =~ s/<?.B>//g;
%rec = &get_record($in{$db_key});

unless ($in{'email_message'}) {
foreach $col (@db_cols) {
$in{'email_message'} .= "$col: $rec{$col}\n";
}
}



to



sub html_forward_email_form {
#----------------------------------------------------------
my ($message) = $_[0];
$in{$db_key} =~ s/<?.B>//g;
%rec = &get_record($in{$db_key});

unless ($in{'email_message'}) {
foreach $col (@db_cols) {
$in{'email_message'} .= "$col: $rec{$col}\n <br>";
}
}

I just added the <br>



Thanks,

Dave
Quote Reply
Re: [daverad] This may be easy In reply to
This regex is wrong:

Code:
$in{$db_key} =~ s/<?.B>//g;

It should be:

Code:
$in{$db_key} =~ s|</?B>||ig;