sql_query("SELECT * FROM gcats ORDER BY position"); $portfolios = $db->fetched_array(); if(isset($_GET['cid'])) { $db->sql_query("select * from images where cid='".$_GET['cid']."' order by position"); $portfolio = $db->fetched_array(); } else { $db->sql_query("select * from images where cid='".$portfolios[0]['id']."' order by position"); $portfolio = $db->fetched_array(); } $smarty->assign("portfolio",$portfolio); $smarty->display("gallery_fr.html"); ?>