Page 1 of 1

PostPosted: Wed Nov 29, 2006 12:16 am
by ozrebel
Here's yet another question sorry!

Is it possible to add extra mail headers into a dataface trigger.

I would like to be able to add header information.

Cheers

Tony

PostPosted: Wed Nov 29, 2006 11:18 am
by shannah
Yes. I guess you're referring to the trigger example in the tutorial which used the PHP mail() function. Check out the php.net mail manual for how to do this.
http://ca3.php.net/manual/en/function.mail.php

Alternatively you can use any of the multitude of PHP libraries for sending email.
e.g. The PEAR classes:
http://pear.php.net/packages.php?catpid=14&catname=Mail

Or PHP Mailer:
http://phpmailer.sourceforge.net/

Hope this helps a little.

-Steve

PostPosted: Wed Nov 29, 2006 8:25 pm
by ozrebel
Thanks Steve.

Running the following code:



Produces the following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/mistro/public_html/dataface/cda/tables/cda_order/cda_order.php:20) in /home/mistro/public_html/dataface/actions/new.php on line 147

I tried commenting out line 147 in new.php with no joy.

Any other pointers?

Tony

PostPosted: Wed Nov 29, 2006 9:10 pm
by ozrebel
Damn - the code doesn't show up!

Maybe without the php tags it will:

class tables_cda_order {

/**
* Trigger that is called after Course record is inserted.
* @param $record Dataface_Record object that has just been inserted.
*/
function afterInsert(&$record){
mail('tfrancis@mistro.ag', 'New CDA Order Added', 'A new CDA Order has just been added to the database. Please visit the CDA website at http://cda.mistro.ag as soon as possible to view it.', 'From: tfrancis@mistro.ag' . "\r\n" .
'Reply-To: tfrancis@mistro.ag' . "\r\n" .
'X-Mailer: PHP/' . phpversion());
}
}

PostPosted: Thu Nov 30, 2006 10:24 pm
by shannah
OK.. this is probably the most frequently encountered problems with PHP. The problem actually occurs at the end of your cda_order.php file and not the new.php file. There is extra white space after your closing ?> tag. Removing this white space will fix the problem.

-Steve

PostPosted: Fri Dec 01, 2006 4:22 pm
by ozrebel
Man you're good!!

Thanks again for all your help. I've now got this application ready for publication, so I can take my time and potter around tinkering with things to find out all of the other great features dataface has got. I have also downloaded LCMS, so I'll have a go at installing that with a view long term to maybe moving away from Joomla.

Cheers

Tony

PostPosted: Fri Dec 01, 2006 5:05 pm
by shannah
Thanks for downloading LCMS.. realistically Joomla is much more mature and feature rich with a bigger community than LCMS. LCMS is just a nice little thing that allows you to store some of your pages in the database (and easily add multilingual features if desired)... but it can't compare in features to one of the big CMSs (Plone, Drupal, Mambo, Joomla)..

But if you're looking for something light-weight and simple, then LCMS might be good for you.

Best regards

Steve