Ir para conteúdo
Fórum Script Brasil
  • 0

Fixa Tabela


melanie

Pergunta

FIXA TABELA

O conteúdo que fica no centro

<TD width="504" rowspan="18" valign="top" bgcolor="#FFFFFF">

As informações são fornecidas do banco; o que acontece, toda vez que é adicionado mais informações, a linha tende a aumentar e com isso,

<TD COLSPAN=2 ROWSPAN=4> onde está o logo e os demais: acervo, cadastro, lista completa, emprestar, devolver, login e filmes novos ficam com UMA MAL FORMATAÇÃO, pois acompanham o conteúdo.

Segue a code:

<BODY>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0 class="dim">
<TR>
<TD height="20"COLSPAN=4><img src="../images/top.gif" width="100%" height="20"></TD>
<TD width="2" height="20"></TD>
</TR>
<TR>
<TD COLSPAN=2 ROWSPAN=4><IMG SRC="../images/logo.gif" WIDTH=246 HEIGHT=175></TD>
<TD height="20"COLSPAN=2 align="right"><form action="" method="post" name="busca" class="style1" id="busca">
<strong>Busca </strong>
<label>
<input name="textfield" type="text" maxlength="50">
</label>
<label>
<input name="submit" type="submit" value="Ok">
</label>
<br>
<input name="Titulo" type="radio" value="radiobutton">
Tìtulo
<label>
<input name="genero" type="radio" value="radiobutton">
</label>
Gênero
<label>
<input name="elenco" type="radio" value="radiobutton">
</label>
Ator
</form></TD>
<TD width="2" height="45"></TD>
</TR>
<TR>
<TD><IMG SRC="../images/acervo.gif" WIDTH=100% HEIGHT=68></TD>
<TD width="5" height="68"></TD>
</TR>
<TR>
<TD width="504" rowspan="18" valign="top" bgcolor="#FFFFFF">
<?
$sql="select * from filmes order by id";
$cont=0; 
include "../includes/Conexao.php";
$sql_result = mysql_query($sql,$connection)
or die ("Não foi possível executar o comando SQL!");?>
<br>
</br>
<table width="153" height="229" align="center" bgcolor="#FFFFFF">
<tr>
<? while($row = mysql_fetch_array($sql_result)) {?>
<td width="137"><div align="center"><a href="descricao.php?id=<?=$row["id"]?>"><img src="../produtos/<?=$row["foto"]?>"" width=100 height=153 border="0"></a></div>
<div align="center"><?=$row["titulo"]?></div>
<td width="4"colspan="16"></td>
<? $cont=$cont+1;
if ($cont==4) {?>
</tr>
<tr>
<td colspan="15"></td>
</tr>
<tr>
<?$cont=0;}
}?> 
</tr>
</table></TD>
<TD width="5"height="13"></TD>
</TR>
<TR>
<TD width="5" height="55"></TD>
</TR>
<TR>
<TD height="13"COLSPAN=2></TD>
<TD width="5" height="13"></TD>
</TR>
<TR>
<TD width="92" height="192"ROWSPAN=14><br></TD>
<TD width="163" height="1"></TD>
<TD width="5" height="1"></TD>
</TR>
<TR>
<TD><a href="acervo.php"><IMG SRC="../images/acervo-12.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><IMG SRC="../images/cadastro.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><IMG SRC="../images/lista.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><IMG SRC="../images/emprestar.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><IMG SRC="../images/devolver.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><IMG SRC="../images/login.gif" WIDTH=163 HEIGHT=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD width="163" height="5"></TD>
<TD width="5" height="5"></TD>
</TR>
<TR>
<TD><a href="#"><img src="../images/novos.gif" width=163 height=23 border="0"></a></TD>
<TD width="5" height="23"></TD>
</TR>
<TR>
<TD height="245%" COLSPAN=2 ROWSPAN=2></TD>
<TD width="5" height="251"></TD>
</TR>
<TR>
<TD><IMG SRC="../images/index_25.gif" WIDTH=100% HEIGHT=3></TD>
<TD width="5" height="3"></TD>
</TR>
<TR>
<TD COLSPAN=4><img src="../images/rodape.gif" width="100%" height="20"></TD>
<TD width="2" height="20"></TD>
</TR>
</TABLE>
</BODY>

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Olá, encontrei alguns problema em um trecho do código. No código abaixo apontei alguns problema que possa está interferindo no layout por inteiro:

Seu código:

<table width="153" height="229" align="center" bgcolor="#FFFFFF">
<tr>
<? while($row = mysql_fetch_array($sql_result)) {?>
<td width="137"><div align="center"><a href="descricao.php?id=<?=$row["id"]?>"><img src="../produtos/<?=$row["foto"]?>"" width=100 height=153 border="0"></a></div>
<div align="center"><?=$row["titulo"]?></div>
<td width="4"colspan="16"></td>
<? $cont=$cont+1;
if ($cont==4) {?>
</tr>
<tr>
<td colspan="15"></td>
</tr>
<tr>
<?$cont=0;}
}?>
</tr>
</table>
Linha 3 – O while deve ficar antes do <tr>, porque ele vai repetir as células e não as linhas, e nesse caso irá distorcer o layout. Linha 4 – Esse <td> abre mais não fecha, e o parâmetro da imagem tinha uma aspa a mais. Linha 7 – O IF tem que ficar fora da linha, pois caso o cantador seja = 4 ele não vai executar o conteúdo abaixo, então a intenção é não executar a próxima linha e não “meia linha”. Linha 13 – Aqui você abre um <tr></tr> e não há nenhuma célula dentro dessa linha, isso não existi então eu exclui.. Linha 14 - O contador estava junto com a abertura da tag do php <?$cont=0;}, isso não ia funcionar só dei um espaço, <? $cont=0;}. Como deve ficar:
<table width="153" height="229" align="center" bgcolor="#FFFFFF">
<tr>
<? while($row = mysql_fetch_array($sql_result)) {?>
    <td width="137">
        <div align="center">
            <a href="descricao.php?id=<?=$row["id"]?>">
                <img src="../produtos/<?=$row["foto"]?>" width="100" height="153" border="0">
            </a>
        </div>
        <div align="center">
            <?=$row["titulo"]?>
        </div>
    </td>
    <td width="4"colspan="16"></td>
</tr>
<? $cont=$cont+1;
if ($cont==4) {?>
<tr>
    <td colspan="15"></td>
</tr>
<? $cont=0;}
}?>
</table>

Bom eu só validei essa parte do código, tenta lá qualquer coisa me contate.

Vale uma dica, endente sempre o código como eu fiz, se abrir uma tag pule linha e der um espaçamento para o próximo elemento, assim facilita a visualização do código.

Editado por TibumWeb
Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...