У меня есть следующий код PHP:
$temp_str .= '
<table width="300" height="84" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="80" rowspan="4"><img src="img/planets/1sm.jpg" width="80" height="82" /></td>
<td width="110">System '.$user[location].'</td>
<td width="110">'.$planets[planet_name].'</td>
</tr>
<tr>
<td colspan="2">This planet is guarded by '.$planets[fighters].' Fighters</td>
</tr>
<tr>
<td colspan="2">Clan ID</td>
</tr>
<tr>
<td>Attack</td>
<td>Special Weapon</td>
</tr>
</table>
';
Достаточно прост и прекрасно выглядит.
Я пытаюсь вставить следующее в поля Attack
и Special weapon
;
Атака;
if(($planets['login_id'] == $user['login_id']) ||
($planets['clan_id'] == $user['clan_id'] &&
$planets['clan_id'] != 0) || ($user['login_id'] == ADMIN_ID) ||
($planets['fighters'] == 0) || $user['ship_id'] == NULL) {
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]><img src=\"img/icons/Land.png\" alt=\"Land\" /></a>";
} else {
if($flag_planet_attack != 0){
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]&attack_planet=1><img src=\"img/icons/Attack.png\" alt=\"Attack\" /></a>";
Специальное оружие;
if(ereg("sv",$user_ship['config'])) { //quark disrupter
$temp_str .= " - <a href=attack.php?quark=1&planet_num=$planets[planet_id]>Fire Quark Displacer</a>";
} elseif(ereg("sw",$user_ship['config']) && $enable_superweapons == 1) { //terra maelstrom
$temp_str .= " - <a href=attack.php?terra=1&planet_num=$planets[planet_id]>Fire Terra Maelstrom</a>";
}
if($planets['pass'] != '0') {
$temp_str .= " - <a href=planet.php?planet_id=$planets[planet_id]>Have Pass</a>";
Но я продолжаю получать неожиданные ошибки, t_string,> все.
Может кто-нибудь сказать мне, что я здесь не так делаю?
Ваша помощь очень ценится.
Ниже приведен полный код, который я пытаюсь ... разбить, наверное:
if(($planets['login_id'] == $user['login_id']) ||
($planets['clan_id'] == $user['clan_id'] &&
$planets['clan_id'] != 0) || ($user['login_id'] == ADMIN_ID) ||
($planets['fighters'] == 0) || $user['ship_id'] == NULL) {
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]><img src=\"img/icons/Land.png\" alt=\"Land\" /></a>";
} else {
if($flag_planet_attack != 0){
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]&attack_planet=1><img src=\"img/icons/Attack.png\" alt=\"Attack\" /></a>";
if(ereg("sv",$user_ship['config'])) { //quark disrupter
$temp_str .= " - <a href=attack.php?quark=1&planet_num=$planets[planet_id]>Fire Quark Displacer</a>";
} elseif(ereg("sw",$user_ship['config']) && $enable_superweapons == 1) { //terra maelstrom
$temp_str .= " - <a href=attack.php?terra=1&planet_num=$planets[planet_id]>Fire Terra Maelstrom</a>";
}
if($planets['pass'] != '0') {
$temp_str .= " - <a href=planet.php?planet_id=$planets[planet_id]>Have Pass</a>";
}
}
}
}
$planets = dbr(1);
}//end while
}
Это то, чего я пытаюсь достичь, но, похоже, я оставляю что-то открытым.
$temp_str .= '
<table width="300" height="84" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="80" rowspan="4"><img src="img/planets/1sm.jpg" width="80" height="82" /></td>
<td width="110">System '.$user[location].'</td>
<td width="110">'.$planets[planet_name].'</td>
</tr>
<tr>
<td colspan="2">This planet is guarded by '.$planets[fighters].' Fighters</td>
</tr>
<tr>
<td colspan="2">Clan ID</td>
</tr>
<tr>
<td>';
if(($planets['login_id'] == $user['login_id']) ||
($planets['clan_id'] == $user['clan_id'] &&
$planets['clan_id'] != 0) || ($user['login_id'] == ADMIN_ID) ||
($planets['fighters'] == 0) || $user['ship_id'] == NULL) {
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]><img src=\"img/icons/Land.png\" alt=\"Land\" /></a>";
} else {
if($flag_planet_attack != 0){
$temp_str .= "- <a href=planet.php?planet_id=$planets[planet_id]&attack_planet=1><img src=\"img/icons/Attack.png\" alt=\"Attack\" /></a></td>
<td>";
if(ereg("sv",$user_ship['config'])) { //quark disrupter
$temp_str .= " - <a href=attack.php?quark=1&planet_num=$planets[planet_id]>Fire Quark Displacer</a>";
} elseif(ereg("sw",$user_ship['config']) && $enable_superweapons == 1) { //terra maelstrom
$temp_str .= " - <a href=attack.php?terra=1&planet_num=$planets[planet_id]>Fire Terra Maelstrom</a>";
}
if($planets['pass'] != '0') {
$temp_str .= " - <a href=planet.php?planet_id=$planets[planet_id]>Have Pass</a>";
}
}
}
}
$planets = dbr(1);
}//end while
}
</td>
</tr>
</table>
';