Friday 26 September 2008 7:15:39 am
To send email from an extension you can use the eZMail class (lib/ezutils/class/ezmail.php).
$mail = new eZMail();
$mail->setSender( '[email protected]' );
$mail->setReceiver( '[email protected]' );
$mail->setSubject( 'This is the subject' );
$mail->setBody( 'This is the actual email text.' );
$mailResult = eZMailTransport::send( $mail );
If you want to use a template for the email you can do something like this:
$mail->setBody( $tpl->fetch( "design:mymodule/myview.tpl" ) );
You would have to put that template in extension/myextension/design/standard/mymodule/myview.tpl. Also you must add something like this to the beginning of your php-file for the template to work:
require_once( "kernel/common/template.php" );
$tpl = templateInit();
To fetch a node and some of its child nodes do something like this:
$node = eZContentObjectTreeNode::fetch( nodeID );
$conditions= array( 'Depth' => $maxDepth );
$conditions['ClassFilterType'] = 'include';
$conditions['ClassFilterArray'] = $classArray;
$children = $node->subTree( $conditions );
The conditions array can contain the same conditions that a template fetch function can so you can probably use this method for your search. I hope this helps.
|