executa("select * from cad_tx_pagina where pagina = 'apostila' ");
$row_tx_pagina = $obj_tx_pagina -> fetchArray();
$obj_tx = new Titulo;
$obj_tx -> cont_tx_700($row_tx_pagina["tit"], $row_tx_pagina["tx"]);
# -------------- FIM ESCREVENTO O TEXTO DO TOPO DA PAGINA -------------------#
echo '
'.propaganda('170x90').'
';
#------- INICIO SQL BUSCANDO CATEGORIAS ---------#
$id = addslashes(strip_tags($_GET['id']));
$ordem = $id == 1 ? 'asc' : 'desc';
$obj_apostila_categoria = new Principal;
$obj_apostila_categoria -> executa("select * from cad_apostila_categoria where cod in (select cod_apostila_categoria from cad_apostila ) order by cod $ordem ");
#------- FIM SQL BUSCANDO CATEGORIAS ---------#
while($row_apostila_categoria = $obj_apostila_categoria -> fetchArray())
{//INICIO LISTANDO AS CATEGORIAS DE APOSTILA
$x++;
$obj_tx -> cx_tit_azul("Compras ".$row_apostila_categoria["categoria"]);
$cod_categoria = $row_apostila_categoria["cod"];
$obj_apostila = new Principal;
$obj_apostila -> executa("select * from cad_apostila where cod_apostila_categoria = '$cod_categoria' order by cod desc ");
$x_linha = 0;
$x_coluna = 0;
echo '
';
while($row_apostila = $obj_apostila -> fetchArray())
{//INICIO LISTANDO AS APOSTILAS
$x_coluna++;
if($x_coluna == 1)
{
$coluna = "";
}
else if($x_coluna == 2 || $x_coluna == 3)
{
$coluna = ' | ';
}
else if($x_coluna == 4)
{
$coluna = '
|
';
$x = 0;
$x_coluna = 1;
}
echo "$coluna";
$variaveis ="$row_apostila[cod]/".variavel_url($row_apostila["tit"]);
$endereco = $cod_categoria == 1 ? 'apostila_instituicao'.$variaveis : 'apostila_individual'.$variaveis;
//$endereco = $row_apostila["url"];
$obj_tx -> cx_apostila_g( $row_apostila["tit"], $row_apostila["descricao"], $row_apostila["img"], $endereco);
echo " | ";
}//FIM LISTANDO AS APOSTILAS
echo '
';
}//FIM LISTANDO AS CATEGORIAS DE APOSTILA
?>