$first = true;
if($first) {
...code...
$first = false;
}
But I think would be better understand where is the problem with the component developer.
Вопрос
I use this script to send email after comment, it's k2 component from joomla, but i get every time 2 emails, how can i count runs and start this script only 1 time?
my code looks so:
$mailer =& JFactory::getMailer();
$config =& JFactory::getConfig();
$sender = array(
$config->getValue( 'config.mailfrom' ),
$config->getValue( 'config.fromname' ) );
$mailer->setSender($sender);
$recipient = explode(",", " marco3pollini@gmail.com");
$mailer->addRecipient($recipient);
$mailer->setSubject(JText::_('New comment is arrived'));
if (!trim($commentURL)=="") {
$commentURL = "Site: ". $commentURL. "\n";
}
$body = "Name: ". $userName. "\n". "E-mail: ". $commentEmail. "\n". $commentURL. "Comment: ". $commentText;
$mailer->setBody($body);
$mailer->isHTML(true);
$mailer->Send();
Решение
$first = true;
if($first) {
...code...
$first = false;
}
But I think would be better understand where is the problem with the component developer.