Foros del Web » Programando para Internet » PHP »

Columnas en PHp

Estas en el tema de Columnas en PHp en el foro de PHP en Foros del Web. Hola Gracias por sugerirme donde encontrar este sistema de Links Necesito ayuda sobre como crear tres columnas porque este solo trae dos en la parte ...
  #1 (permalink)  
Antiguo 11/06/2004, 12:46
Avatar de yuguilley  
Fecha de Ingreso: febrero-2004
Ubicación: Montenegro Quindío
Mensajes: 108
Antigüedad: 20 años, 2 meses
Puntos: 0
Columnas en PHp

Hola

Gracias por sugerirme donde encontrar este sistema de Links

Necesito ayuda sobre como crear tres columnas porque este solo trae dos
en la parte Link Directory
ver ejemplo

http://68.97.138.88:40/demo/

Les agradesco la ayuda
» este es el codigo
-----------------------------------------------------------
<?php
/**
* PHP-X-LINKS a simple link repository
* Copyright (C) 2003, 2004 Jesse Waite
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

if (eregi('main.php', $_SERVER['PHP_SELF'])){
Header('Location: index.php');
die();
}
?>
<table border="0" width="100%" cellpadding="10" cellspacing="0" class="bg_color">
<tr>
<td width="100%" align="left" class="underline"><font size="4"><?php echo $strMainDirTitle; ?></font></td>
</tr>
</table>
<table width="533" height="40" border="0" cellpadding="5" cellspacing="0" class="bg_color">
<tr>
<td width="335" height="40" align="left" valign="top">
<?php
$sql = 'SELECT * from ' . PREFIX . 'category ORDER BY name';
$result = mysql_query($sql, $conn) or die(mysql_error());
$i = 0;
while ($r = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($r['parent_id'] == 0) {
$tr = ($i % 2) ? '</td></tr><tr><td align="left" width="200" valign="top">' : '</td><td align="left" width="200" valign="top">';
echo '<body><img src="images/folder.gif" alt="" width="16" height="16" align="absmiddle" title="' . $r['name'] . '"/>
<a href="view.php?cid=' . $r['id'] . '"><b>' . $r['name'] . '</b></a><font size="2"></font><br/>';
$query = 'SELECT * FROM ' . PREFIX . 'category
WHERE parent_id=\'' . $r['id'] . '\'
ORDER BY RAND() LIMIT 3';
$results = mysql_query($query, $conn) or die(mysql_error());
$n = 2;
while ($sub = mysql_fetch_array($results, MYSQL_ASSOC)) {
echo '<a href="view.php?cid=' . $sub['id'] . '" class="smallfont">' . $sub['name'] . '</a><font size="-2"></font>';
echo ($n % 4) ? ', ' : ' ...';
$n++;
} // while
echo $tr;
$i++;
}
} // while

?>
</table>
<?php
$sql = array('0' => 'SELECT COUNT(id) AS cnt FROM ' . PREFIX . 'urls WHERE dead_link != \'L\'',
'1' => 'SELECT COUNT(id) AS cnt FROM ' . PREFIX . 'category',
'2' => 'SELECT SUM(hits) AS cnt FROM ' . PREFIX . 'urls WHERE dead_link != \'L\'');
for ($i = 0; $i < count($sql); $i++) {
$result = mysql_query($sql[$i], $conn);
while($r = mysql_fetch_array($result, MYSQL_ASSOC)){
$count[] = $r['cnt'];
} // while
}
//print_r($count);
?>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="bg_color">
<tr>
<td align="center">
<span class="small">
[&nbsp;<?php echo $strMainLinks; ?> <?php echo $count[0]; ?>&nbsp;|
<?php echo $strMainClicks; ?> <?php echo $count[2]; ?>&nbsp;|
<?php echo $strMainCategories; ?> <?php echo $count[1]; ?>&nbsp;]</span>
</td>
</tr>
</table>
-----------------------------------------------------------

Última edición por yuguilley; 11/06/2004 a las 12:55
  #2 (permalink)  
Antiguo 11/06/2004, 13:54
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Así a "ojo" (sin probar ni ver más el código) .. puede ser en:

$n= 2;

Un saludo,

PD: .. intenta probar y ver que hacen las funciones . .si te fijas son bucles y por ahí se hace una operación matemática (módulo de una división = resto) para hacer las columnas ..
  #3 (permalink)  
Antiguo 11/06/2004, 17:40
Avatar de yuguilley  
Fecha de Ingreso: febrero-2004
Ubicación: Montenegro Quindío
Mensajes: 108
Antigüedad: 20 años, 2 meses
Puntos: 0
hOLA HE INTENTADO DE VARIAS FORMAS Y NO ME ORGANIZA EN TRES O MAS COLUMNAS SOLO ME APARECEN FILAS

QUE DEBO O PUEDO HACER?

GRACIAS
  #4 (permalink)  
Antiguo 14/06/2004, 06:56
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Leer esta FAQ:

http://www.forosdelweb.com/showthrea...669#post240669

Un saludo,

PD: Las mayusculas significa "gritar" .. intenta no usarlas más que lo necesario.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:01.