set_file("listing", "firm_listing.tpl"); $template->set_block("listing", "moscow_block", "moscow"); $template->set_block("moscow_block", "moscow_row", "m_row"); $template->set_block("listing", "other_block", "other"); $template->set_block("other_block", "other_row", "o_row"); $template->set_block("listing", "spb_block", "spb"); $template->set_block("spb_block", "spb_row", "s_row"); $template->set_block("listing", "rb_block", "rb"); $template->set_block("rb_block", "rb_row", "b_row"); $template->set_var(array( "HEAD" => head(), "BOTTOM" => bottom()) ); $sql = "SELECT f_id, f_metro, f_town, f_name, f_tel FROM firms WHERE firms.f_show_end > NOW() AND ((firms.f_flags & ".$_flags['show'].") = ".$_flags['show'].") ORDER BY f_order ASC"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { extract($row); if (empty($f_town)){ $template->set_var(array( "moscow_row.METRO" => $f_metro, "moscow_row.FIRM" => $f_name, "moscow_row.HREF" => SITE_URL."go.php?id=".$row['f_id'], "moscow_row.PHONE" => $f_tel) ); $template->parse("m_row", "moscow_row", true); } else { if ($f_town == "Санкт-Петербург"){ $template->set_var(array( "spb_row.METRO" => $f_metro, "spb_row.FIRM" => $f_name, "spb_row.HREF" => SITE_URL."go.php?id=".$row['f_id'], "spb_row.PHONE" => $f_tel) ); $template->parse("s_row", "spb_row", true); } if (!empty($f_town)and($f_town != "Санкт-Петербург")) { $template->set_var(array( "rb_row.METRO" => $f_town, "rb_row.FIRM" => $f_name, "rb_row.HREF" => SITE_URL."go.php?id=".$row['f_id'], "rb_row.PHONE" => $f_tel) ); $template->parse("b_row", "rb_row", true); } } } $template->parse("moscow", "moscow_block", true); $template->parse("spb", "spb_block", true); $template->parse("rb", "rb_block", true); $template->pparse("listing", "listing"); ?>