I make one email function in that function i set the code of email template and also set the value which are i fetched from database.i upload one image in which the status field is 3 now i want to print confirmed instead of 3 in my email template.Here in the order array i get all the data.What i do to print Confirmed instead of 3.
我在该功能中设置了一个电子邮件功能我设置了电子邮件模板的代码,并设置了从数据库中获取的值。我上传了一个图像,其中状态字段为3现在我要在我的电子邮件中打印已确认而不是3 template.Here in order array我得到了所有的数据。我做什么打印确认而不是3。
public function setworkerTemplate($RESPONSE,$name)
{
$temp=$RESPONSE['temp'];
$order=$RESPONSE['order'];
$cust=$RESPONSE['cust'];
$workers=$RESPONSE['workers'];
echo "<pre>";
print_r($order);
$logo=JURI::root()."images/logo-1.png";
$html ='<html>';
$html.='<body>';
$html.='<div style="width:100%; background-color:#f6f6f6; border-top:#337ab7 5px solid; border-bottom:#337ab7 5px solid;">';
$html.='<div style=" margin-left:15%; margin-right:15%; ">';
$html.='<div style=" margin-top:5%;">';
$html.='<center><img src="'.$logo.'" style="width:200px; height:100px;"></center>';
$html.='</div>';
$html.='<div style=" margin-top:1%; color: #666; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; line-height: 16px;">';
$html.='<b>Dear ,'.$workers['firstname'].'</b><br>';
$html.='<br>';
$html.='<b>Please find details about your schedule today for <a href="#">steamatichv.com</a> below.</b><br>';
$html.='<br>';
$html.='<table style="width:100%;" border="1" cellspacing="0" cellpadding="5" bgcolor="#FFFFFF" bordercolor="#cccccc ">';
$html.='<tr style=" box-shadow: 0px 0px 3px #888888;;">';
$html.='<td style="padding-left: 5px;"><b>Order Number</b></td>';
$html.='<td style="padding-left: 5px;"><b>Schedule Date</b></td>';
$html.='<td style="padding-left: 5px;"><b>Schedule Time</b></td>';
$html.='<td style="padding-left: 5px;"><b>Status</b></td>';
$html.='</tr>';
$html.='<tr>';
$html.='<td>'.$order['Order_number'].'</td>';
$html.='<td>'.$order['schedule_date'].'</td>';
$html.='<td>'.$order['schedule_timeslot'].'</td>';
**[$html.='<td>'.$order\['published'\].'</td>';][1]**
$html.='</tr>';
$html.='</table><br>';
$html.='<div style=" margin-top:1%; color: #666; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; line-height: 16px;">';
$html.='<p>Regards,<br>Steamatic HV Team</p>';
$html.='</div>';
$html.='</div>';
$html.='</div>';
$html.='</body>';
$html.='</html>';
return $html;
}
1 个解决方案
#1
1
You can use ternary operator.
您可以使用三元运算符。
$html.='<td>'.($order['published'] == 3 ? 'Confirmed' : 'Unconfirmed').'</td>';
If you have more than one case:
如果您有多个案例:
$html .= '<td>';
if($order['published'] == 1)
$html .= 'Pending';
else if($order['published'] == 2)
$html .= 'Cancelled';
else if($order['published'] == 3)
$html .= 'Confirmed';
else
$html .= 'Unknown';
$html .= '</td>';
#1
1
You can use ternary operator.
您可以使用三元运算符。
$html.='<td>'.($order['published'] == 3 ? 'Confirmed' : 'Unconfirmed').'</td>';
If you have more than one case:
如果您有多个案例:
$html .= '<td>';
if($order['published'] == 1)
$html .= 'Pending';
else if($order['published'] == 2)
$html .= 'Cancelled';
else if($order['published'] == 3)
$html .= 'Confirmed';
else
$html .= 'Unknown';
$html .= '</td>';