define(array( main => "stories.tpl", story => "storiest.tpl", dyn => "golddyn.tpl", flick => "flickafact2.tpl", feature => "feature.tpl", storynav => "storynav.tpl", navbottom => "navbottom.tpl")); $tpl->define_dynamic("links","dyn"); $tpl->define_dynamic("leftstorynav","dyn"); $tpl->define_dynamic("navpreload","dyn"); $tpl->define_dynamic("navpreloadsrc","dyn"); $tpl->define_dynamic("list","dyn"); $tpl->define_dynamic("breadcrumb","dyn"); $tpl->define_dynamic("breadcrumbtpc","dyn"); $tpl->define_dynamic("topic","dyn"); $tpl->define_dynamic("prevnext","dyn"); $tpl->define_dynamic("breadcrumbtpct","dyn"); $tpl->parse(BREADCRUMB,".breadcrumb"); error_reporting(0); $tpl->no_strict(); if($topicid){ $querytopicid = mysql_query("select title,summary,id from gold.perspectives where goldtopic = '$topicid' and alive = '1' order by disporder",$db); $z = mysql_num_rows($querytopicid); for($p=0;$p<$z;$p++){ $data = row_replace($querytopicid,$p); $tpl->assign($data); $tpl->parse(LISTLINK,"links"); $tpl->parse(STORYT,".list"); } $querytopic = mysql_query("select title,topicid,summary from gold.goldtopic where topicid = '$topicid'",$db); $data = row_result($querytopic,0); $breadcr[IDTYPE] = "topicid"; $breadcr[IDS] = $data[TOPICID]; $breadcr[IDNAME] = $data[TITLE]; $breadcr[SUMMARY] = $data[SUMMARY]; $tpl->assign($breadcr); $tpl->parse(BREADCRUMB,".breadcrumbtpct"); $tpl->parse(STORY,"topic"); $tpl->parse(FLICKAFACT,"flick"); }elseif($storyid){ $querystoryid = mysql_query("select * from gold.perspectives where id = '$storyid'",$db); $data = row_replace($querystoryid,0); $querystoryskip = mysql_query("select * from gold.perspectives where GOLDTOPIC = '$data[GOLDTOPIC]' and alive ='1' and id != '$storyid' order by disporder",$db); $picturequery = mysql_query("select name from media.filereference where siteid = '2' and featureid = '$data[GOLDTOPIC]' and live = '1' order by filedisporder",$db_old); $data[IMAGE] = mysql_result("$picturequery",0,"name"); $data[CONTENT] = replacerf($data[CONTENT],$data[ID],$db_old); $z = mysql_num_rows($querystoryskip); if($z>1){ if($data[DISPORDER] == $z+1){ $data[STORYNEXT] = mysql_result($querystoryskip,0,"id"); }else{ $data[STORYNEXT] = mysql_result($querystoryskip,$data[DISPORDER]-1,"id"); } if($data[DISPORDER] == 1){ $data[STORYPREV] = mysql_result($querystoryskip,$z-1,"id"); }else{ $data[STORYPREV] = mysql_result($querystoryskip,$data[DISPORDER]-2,"id"); } $tpl->assign($data); $tpl->parse(PREVNEXT,"prevnext"); }else{ $tpl->assign($data); } $tpl->parse(STORY,"story"); $topicid = $data[GOLDTOPIC]; $querytopic = mysql_query("select title,topicid from gold.goldtopic where topicid = '$topicid'",$db); $data2 = row_result($querytopic,0); $breadcr[IDTYPE] = "topicid"; $breadcr[IDS] = $data2[TOPICID]; $breadcr[IDNAME] = $data2[TITLE]; $tpl->assign($breadcr); $tpl->parse(BREADCRUMB,".breadcrumbtpc"); $breadcr[IDTYPE] = "storyid"; $breadcr[IDS] = $data[ID]; $breadcr[IDNAME] = $data[TITLE]; $tpl->assign($breadcr); $tpl->parse(BREADCRUMB,".breadcrumbtpct"); } $querynav = mysql_query("select name from media.filereference where featureid = '$topicid' and siteid ='2' and live = '1' order by filedisporder",$db_old); $data[NAME] = mysql_result($querynav,0,"name"); $tpl->assign($data); $querynav = mysql_query("select title,id from gold.perspectives where goldtopic = '$topicid' and alive = '1' order by disporder",$db); $z = mysql_num_rows($querynav); for($p=0;$p<$z;$p++){ $data = row_result($querynav,$p); $tpl->assign($data); $tpl->parse(LINK,".links"); } $querynav = mysql_query("select * from gold.goldtopic where topicid != '$topicid' and txdate <= now() or txdate='2003-07-16' order by txdate",$db); $z = mysql_num_rows($querynav); for($p=0;$p<$z;$p++){ $data = row_result($querynav,$p); $picturequery = mysql_query("select name from media.filereference where siteid = '2' and featureid = '$data[TOPICID]' and live = '1' order by filedisporder",$db_old); $data[IMAGE0] = mysql_result($picturequery,0,"name"); $data[IMAGE1] = mysql_result($picturequery,1,"name"); $data[P] = $p; $tpl->assign($data); $tpl->parse(PRELOADNAV,".navpreload"); $tpl->parse(PRELOADNAVSRC,".navpreloadsrc"); $tpl->parse(TOPLEFTNAV,".leftstorynav"); } $data[REFER] = urlencode("$QUERY_STRING"); $tpl->assign($data); $tpl->parse(NAVLEFT,"storynav"); $tpl->parse(NAVBOTTOM,"navbottom"); $tpl->parse(NAVBOTTOM,"main"); $tpl->FastPrint(); ?>