This topic is locked
[SOLVED]

 Creating a PDF Brochure / Catalogue

7/15/2008 9:39:35 AM
PHPRunner General questions
N
nicolagrimshaw author

I would like to create a brochure / catalogue consisting of the 'view' pages for Master table (hotel information) and detail table (country information) which can be viewed as a PDF or emailed to a customer. Has anyone any ideas how this may be acheived? I have looked at purchasing the tempates pack, as I thought adding to shopping cart may be used, but having looked I'm not sure it can...
Thanks in advance!

J
Jane 7/16/2008

Hi,
I recommend you to have a look at the View in PDF feature:

http://www.xlinesoft.com/phprunner/docs/pdf_view_option.htm

A
Aleix 7/16/2008

I would like to create a brochure / catalogue consisting of the 'view' pages for Master table (hotel information) and detail table (country information) which can be viewed as a PDF or emailed to a customer. Has anyone any ideas how this may be acheived? I have looked at purchasing the tempates pack, as I thought adding to shopping cart may be used, but having looked I'm not sure it can...

Thanks in advance!



Hello;

For mail, you can try with this:

1.- Desing a formulary with the data customer

2.- With the botton save / send in this event Before update o After (could be better, in these way you have the data if there are some problem with the mail)

3.- Write the code for send a mail
The example of code ( I don´t try the code, but I take it from this forum but I can sey to you the item)
{
global $conn,$avalues;
// ** Send Advanced email ****
// Read POST request params into global vars

$to = $avalues["sentTo"];

$from = $avalues["fromID"];

$cc = $avalues["cc"]";

$bcc = $avalues["bcc"];

$sendto = "$to,$cc,$bcc";
$subject = $avalues["subject"];

$message = $avalues["detail"];
$attach = $avalues["attachment"];

$ext = str_replace('.','',strstr($attach, '.'));

//$type = filetype($attach);

//$mime = mime_content_type($attach);

$loc = "UPLOADS/EMAILATTACH/$attach";
// Obtain file upload vars

$fileatt = $loc;

$fileatt_type = $ext;

$fileatt_name = $attach;
//$headers = "From: $from\r\n" . "Cc: $cc\n" . "Bcc: $bcc\n";
$headers = "To: $to\n" .

"From: $from\n" .

"cc: $cc\n" .

"Bcc: $bcc\n" .

"X-Mailer: PHP 5.x";
if ($fileatt) {

// Read the file to be attached ('rb' = read binary)

$file = fopen($fileatt,'rb');

$data = fread($file,filesize($fileatt));

fclose($file);
// Generate a boundary string

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment

$headers .= "\r\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message

$message = "This is a multi-part message in MIME format.\n\n" .

"--{$mime_boundary}\n" .

"Content-Type: text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

$message . "\n\n";
// Base64 encode the file data

$data = chunk_split(base64_encode($data));
// Add file attachment to the message

$message .= "--{$mime_boundary}\n" .

"Content-Type: {$fileatt_type};\n" .

" name=\"{$fileatt_name}\"\n" .

//"Content-Disposition: attachment;\n" .

//" filename=\"{$fileatt_name}\"\n" .

"Content-Transfer-Encoding: base64\n\n" .

$data . "\n\n" .

"--{$mime_boundary}--\n";

}
else {
// Generate a boundary string

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers

$headers .= "\r\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message

$message = "This is a multi-part message in MIME format.\n\n" .

"--{$mime_boundary}\n" .

"Content-Type: text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

$message . "\n\n" .

"--{$mime_boundary}--\n";
}
// Send the message

$ok = @mail($sendto, $subject, $message, $headers);
if ($ok) {

echo "<p>Mail sent! Yay PHPRunner! With File Attachement: $fileatt</p>";

} else {

echo "<p>Mail could not be sent. Sorry!</p>";
END CODE

function AfterAdd() // This can be put into whatever Event you wish, just make sure to change the $xvalue to the corresponding one for the event type you are using this for
I hope help you ( It looks fine!)
Bye

N
nicolagrimshaw author 7/21/2008

Hi Jane,
Thank you for your response. I have already looked at the page and I understand this can be done page by page (however although I have followed the instructions, my page tends to hang) although I assume this can't done for multiple pages at a time - for excample by using a check button to create a brochure of serveral hotels?
Nicola

N
nicolagrimshaw author 7/21/2008



Hello;

For mail, you can try with this:

1.- Desing a formulary with the data customer

2.- With the botton save / send in this event Before update o After (could be better, in these way you have the data if there are some problem with the mail)

3.- Write the code for send a mail
The example of code ( I don´t try the code, but I take it from this forum but I can sey to you the item)
{
global $conn,$avalues;
// ** Send Advanced email ****
// Read POST request params into global vars

$to = $avalues["sentTo"];

$from = $avalues["fromID"];

$cc = $avalues["cc"]";

$bcc = $avalues["bcc"];

$sendto = "$to,$cc,$bcc";
$subject = $avalues["subject"];

$message = $avalues["detail"];
$attach = $avalues["attachment"];

$ext = str_replace('.','',strstr($attach, '.'));

//$type = filetype($attach);

//$mime = mime_content_type($attach);

$loc = "UPLOADS/EMAILATTACH/$attach";
// Obtain file upload vars

$fileatt = $loc;

$fileatt_type = $ext;

$fileatt_name = $attach;
//$headers = "From: $from\r\n" . "Cc: $cc\n" . "Bcc: $bcc\n";
$headers = "To: $to\n" .

"From: $from\n" .

"cc: $cc\n" .

"Bcc: $bcc\n" .

"X-Mailer: PHP 5.x";
if ($fileatt) {

// Read the file to be attached ('rb' = read binary)

$file = fopen($fileatt,'rb');

$data = fread($file,filesize($fileatt));

fclose($file);
// Generate a boundary string

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment

$headers .= "\r\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message

$message = "This is a multi-part message in MIME format.\n\n" .

"--{$mime_boundary}\n" .

"Content-Type: text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

$message . "\n\n";
// Base64 encode the file data

$data = chunk_split(base64_encode($data));
// Add file attachment to the message

$message .= "--{$mime_boundary}\n" .

"Content-Type: {$fileatt_type};\n" .

" name=\"{$fileatt_name}\"\n" .

//"Content-Disposition: attachment;\n" .

//" filename=\"{$fileatt_name}\"\n" .

"Content-Transfer-Encoding: base64\n\n" .

$data . "\n\n" .

"--{$mime_boundary}--\n";

}
else {
// Generate a boundary string

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers

$headers .= "\r\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message

$message = "This is a multi-part message in MIME format.\n\n" .

"--{$mime_boundary}\n" .

"Content-Type: text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

$message . "\n\n" .

"--{$mime_boundary}--\n";
}
// Send the message

$ok = @mail($sendto, $subject, $message, $headers);
if ($ok) {

echo "<p>Mail sent! Yay PHPRunner! With File Attachement: $fileatt</p>";

} else {

echo "<p>Mail could not be sent. Sorry!</p>";
END CODE

function AfterAdd() // This can be put into whatever Event you wish, just make sure to change the $xvalue to the corresponding one for the event type you are using this for
I hope help you ( It looks fine!)
Bye


Thank you Aleix
I will try later.
Nicola

J
Jane 7/22/2008

Hi,
make sure you're using latest PHPRunner update.

http://www.asprunner.com/files/phprunner-setup.zip
Unfortunately you can't open more then one view page in PDF in the same time.