Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,773

    divisione contenuti su due colonne

    salve gente ho un problema e non riesco a trovare una soluzione, io dal db estraggo le FAQ,domanda e risposta , sino che le caricavo in ogni singola colonna andava e va tutto perfettamente, ma ho deciso di fare su due colonne e sto esaurendo, ho fatto cosi:

    Codice PHP:

    $colonne = 2; 
    $tot_righe = $num_record/$colonne; 
    $i_x = 0; 
    $x_x = 0; 
    $k_x = 0; 
    $cell_width = floor(100/$colonne); 
    $DB->connect();
    $controllo_colonne = mysql_query("select * from knowledgebase_cat  where enable ='1' and kat_kvisible ='1'   ");
    $num_record = @mysql_num_rows($controllo_colonne); 

    echo 
    "<table class='tabhome' style='width:100%;' border='0' cellspacing='0' cellpadding='0'> <tr>";  

          
     while($array = mysql_fetch_array($controllo_colonne)){ 
    $i_x++; 
    $k_x++; 
    $x_x++; 
    echo"<td>";

    $DB->connect();
    $result_cat_know = mysql_query("select * from knowledgebase_cat  where enable =1 and kat_kvisible =1  order by id desc ");
    if (@mysql_num_rows($result_cat_know)>0){ 
    while($array=mysql_fetch_array($result_cat_know)){?>

    <table class="knowtitle" border ="0"  cellpadding="0" cellspacing="0" style="width:100%;" >
      <tr>
        <td><table class = "tablecatknow" border ="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class ="imagecategoryknow"><?php echo"[img]$path_site/template/$template/images/icone_mini/icon_folderyellow.gif[/img]";?></td>
              <td class ="categoryknow"><?php echo"[url='$path_site/index.php?page=$page&viewcategory_knowledgebase=viewcategory&id_cat=".$array[']".$array['nome']."[/url]";?> <span class ="numerarticle">(<?php echo totale($array['id']);?>)</span></td>
              <td class ="rssiconknow"></td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td><?php
    $id = $array['
    id'];
    $title = $array['
    nome'];
    $result_know = mysql_query("select * from knowledgebase where  k_cat ='".
    $array['id']."' and  visible ='1'  and enable ='1' order by id desc limit 3" );
    ?>
          <table class = "ultimiarticoliknow" border ="0" cellpadding="0" cellspacing="0" onMouseOver="javascript:this.className='
    navitem'" onMouseOut="javascript:this.className ='navitemhover'" style="width:100%;">
            <?php
    if( @mysql_num_rows($result_know)>0){
    while($array=mysql_fetch_array($result_know)){  ?>
            <tr>
              <td class ="imagearticolokn"><?php echo"[img]$path_site/template/$template/images/icone_mini/icon_topicyellow.gif[/img]";?></td>
              <td class="articoloknow"><?php echo"[url='
    $path_site/index.php?page=$page&viewarticle=viewarticle_knowledgebase&id_article=".$array[']".$array['domanda']."[/url]";?></td>
            </tr>
            <?php
        
    }
        }else{
    ?>
            <tr>
              <td class ="imagearticolokn"></td>
              <td class="articoloknow"><div class="textsfondo"><?php echo _NO_ARTICLE_KNOWLDG ?></div></td>
            </tr>
            <?php    }?>
          </table></td>
      </tr>
    </table>
    <?php 
    }
    }else{ 
    echo
    "<div class='textsfondo'>"._NO_CATEGORY_KNOWLDG."</div>";
     }
    echo
    "</td>";
    if(
    $i_x == $colonne) { 

    echo
    "</tr>"

    if (
    $i_x == $colonne && (($x_x/$colonne) != $tot_righe)) { 
    echo
    "<tr>";
       } 
    $i_x 0
     } 

    if (
    $colonne <= $x_x){ 
    if ((
    $k_x%$colonne) != 0){ 
    $indice $k_x
    $indice++; 
    if((
    $indice%$colonne) == ){ 
    echo
    '</tr>';  
       } 
     }         
    } else{ 

    echo 
    '</tr>';              

    echo 
    '</table>';
    adesso mi da le due colonne ,ma mi scarica il tutto ripetutamente per 3 volte dove toppo?
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,773
    ragazzi mi date una mano
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2005
    Messaggi
    53
    $cell_width = floor(100/$colonne);
    Questa dovresti settarla a 50
    Inoltre dove specifichi il result? Questa funzione l'ho usata per estrarre dei dati da database su più colonne.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.