<? 
include_once("../../cisweb_manual/valida_sessao.php");
protegePagina(); 
include_once("../../cisweb_manual/adm_head.php");
?>	   

<?
include("../../cisweb_manual/CisManual/config.php");
include("../../cisweb_manual/CisManual/utf8.php");
$sql_tlp = "SELECT * FROM templates";
$consulta_tpl = mysql_query($sql_tlp, $conn);
while ($template = mysql_fetch_array($consulta_tpl)) {
	?>
    <h1><?=$template['T_NOME'];?></a></h1>
    
    <?PHP
	$sql = "SELECT * FROM paginas as b INNER JOIN templates as c ON b.P_T_ID = c.T_ID WHERE P_T_ID = ".$template['T_ID']." AND P_SITUACAO = 1 ";
	$consulta = mysql_query($sql,$conn);
	while($registro = mysql_fetch_array($consulta)){
		if(file_exists($registro['P_ARQUIVO'])) {?>
	    <li><a href="<?=$registro['P_ARQUIVO'];?>"><?=$registro['P_NOME'];?></a></li>
    	<?
		}
	}
	?>
	<? }
mysql_close($conn);
?>

<? include_once("../../cisweb_manual/adm_foot.php"); ?>