$v) $post[$k] = $v; $photos = xall_rows(" select * from m_photos where post_key = '$pk' order by add_dt desc "); $post["photos"] = $photos; $post["photos_cnt"] = count($photos); if ($post_type["use_related_links"]) $post["links"] = xall_rows("select * from m_links where post_key = $pk and url <> '' order by post_order"); $post["news"] = xall_rows(" select * from m_post_types pt, m_posts p left join m_icons i on p.icon_key = i.icon_key where pt.post_type = 'news' and pt.post_type_key = p.post_type_key and is_live = 1 order by post_dt desc limit 8 "); $post["news_cnt"] = count($post["news"]); $ptu = $post_type["post_type"]; $template_file = "post-" . string_to_url_component($ptu) . ".phtml"; if (file_exists("templates/$template_file")) { display_template($template_file, $post); } else { $post["template_file"] = $template_file; display_template("post.phtml", $post); } ?>