Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

inserire dati estratti da database in due colonne

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian
View previous topic :: View next topic  
Author Message
rocco.mod
Smarty n00b


Joined: 19 Jan 2008
Posts: 1

PostPosted: Sat Jan 19, 2008 9:27 pm    Post subject: inserire dati estratti da database in due colonne Reply with quote

salve mi aguro che qualcuno qui risponda volevo chiedervi aiuto, v spiego dovrei per il lavoro che sto facendo io recuperare i lmenu da database vi spiego innanzitutto cosa recupero da database l immagine del icona , il titolo , e la descrizione. e le patch. adesso fino a qui ci siamo li estaggo e le asso a smarty ,pero non riesco a farli assegniare a due colonne io estraggo 6 cami del database dove in questi sei campi ripeto c e l immagine titolo e descrizione adesso me li carica ma me li doppia cioè, li assa a smarty ma ne passa 12 da sinistra e copia i lato destro questo e quello che estraggo
Code:
if($autorizzato=="1"){

   $caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='1' and   
      permission='2' and enable ='1' limit 1");
   while($array=mysql_fetch_array($caric_blocks_home)){
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
   } // FIN QUI DOVREBBE ANDARE TUTTO BENE: fai una sola query
} else {   // Anche qui ok, perchè fai una query
$cnt = 0;   // Contatore
   $caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='1' and
      permission='1' and enable ='1' limit 1");
   while($array=mysql_fetch_array($caric_blocks_home)) {
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++; 
   }
}   // Provo a cambiare...

unset($caric_blocks_home);
$caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='2'  and
   enable ='1' limit 1");
while($array=mysql_fetch_array($caric_blocks_home)) {
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
}



unset($caric_blocks_home);
$caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='3'  and
   enable ='1' limit 1");
while($array=mysql_fetch_array($caric_blocks_home)) {
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
}

unset($caric_blocks_home);
$caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='4'  and
   enable ='1' limit 1");
while($array=mysql_fetch_array($caric_blocks_home)){
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
}
unset($caric_blocks_home);
$caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='5'  and
   enable ='1' limit 1");
while($array=mysql_fetch_array($caric_blocks_home)){
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
}
unset($caric_blocks_home);
$caric_blocks_home = mysql_query("select  * from blocks_home where posizione ='6'  and
   enable ='1' limit 1");
while($array=mysql_fetch_array($caric_blocks_home)){
   $valori_da_passare[$cnt]['posizione'] = $array['posizione'];
   $valori_da_passare[$cnt]['img_icon'] = $array['img'];
   $valori_da_passare[$cnt]['path_content'] = $array['path'];
   $valori_da_passare[$cnt]['title_content']  = constant("".$array['nome'].""); 
   $valori_da_passare[$cnt]['descrict_content'] = constant("".$array['description']."");
   // Incremento il contatore
   $cnt++;
}









$smarty->assign("array_lato_sinistro",$valori_da_passare);



$smarty->assign("array_lato_destro",$valori_da_passare);









$smarty->display('index.tpl');

questo e il files tpl
Code:
 <table id='contenutitexticone' border="0" width="100%" cellpadding="0" cellspacing="0" >
  <tr>
  <td>
{foreach name=nome item=row from=$array_lato_sinistro} 
  <table border="1" width="100%"  cellpadding="0" cellspacing="0">
  <tr>
   <td id='iconticket'> <a href ="{$row.path_site}/{$row.path_content}/index.php" target="_parent"><img src="{$path_site}/immagini/{$row.img_icon}.gif" width='60' height='60' /></a> </td>
    <td id='titlemessage'><a href ="{$row.path_site}/{$row.path_content}/index.php" target="_parent"><strong>{$row.title_content}</strong></a><br><span class='smalltext'>{$row.descrict_content}</span> </td>
   </tr>
</table>
{/foreach}
    </td>
     <td>
   {foreach name=nome item=row from=$array_lato_destro}   
<table border="1" width="100%" cellpadding="0" cellspacing="0" >
  <tr>
    <td id='iconticket'> <a href ="{$row.path_site}/{$row.path_content}/index.php" target="_parent"><img src="{$path_site}/immagini/{$row.img_icon}.gif" width='60' height='60' /></a> </td>
   <td id='titlemessage'><a href ="{$row.path_site}/{$row.path_content}/index.php" target="_parent"><strong>{$row.title_content}</strong></a><br><span class='smalltext'>{$row.descrict_content}</span> </td>
  </tr>
 </table>
 {/foreach}
 </td>
 </tr>
</table>
come fare help
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP