With cakephp 2.9 I have this need:
I should check if there is a specific tag on the page that appears.
if it is present, must not do anything else must send me an email.
At this point I think to create a helper and recall a method in the default.ctp
with something like:
$s = this-> fetch (‘content’);
$result_check = $this->myHelper->debug_content ($s);
echo $s;
In the myHelper the function:
public function debug_content( $s) {
$pos = strpos ( $s, "<div class = \"box-body\">");
if ( $pos === false) { echo “Error tag is not present!”;
return false;
}
In the AppController:
public $helpers = array (…, ‘myHelper’);
and up to here ok … but now?
How do I recall the component Email (personalized by me) to send an email?
And where do I call it?
How would you do?
Thank you,
Max
I dont know if I got your question right. But you can implement the needed e-mail sending function into your function where you are checking for the tag.