{php} $bottomRows = []; if (!empty($tplconfig['theme']['ad_slots']['bottom']['ad_data']) && is_array($tplconfig['theme']['ad_slots']['bottom']['ad_data'])) { foreach ($tplconfig['theme']['ad_slots']['bottom']['ad_data'] as $row) { if (!is_array($row)) { continue; } if (strtolower(trim((string)($row['active'] ?? 'off'))) !== 'on') { continue; } $expireAt = isset($row['date']) ? trim((string)$row['date']) : ''; if ($expireAt !== '') { $expireTs = strtotime($expireAt); if ($expireTs !== false && $expireTs < time()) { continue; } } if (empty($row['code'])) { continue; } $bottomRows[] = $row; } } if (!empty($bottomRows)) { usort($bottomRows, function ($a, $b) { $oa = intval($a['order'] ?? 0); $ob = intval($b['order'] ?? 0); if ($oa === $ob) { return 0; } return $oa < $ob ? -1 : 1; }); } {/php} {if condition="($tplconfig['theme']['ads']['btn'] eq 1 || ($tplconfig['theme']['ads']['btn'] eq 2 && isset($user['group_id']) && $user['group_id'] lt 3)) && !empty($bottomRows)"} {php}$bottomOne = $bottomRows[array_rand($bottomRows)];{/php}
 {$bottomOne.code}
{/if}