[Smarty] Affichage multicolonne avec PHP et Smarty
Bonsoir à tous,
Je développe actuellement un site sous php en utilisant un script qui tourne via le Moteur de Template Smarty.
Je ne connais pas encore ce moteur et j ai besoin d afficher une liste en 3 colonnes au lieu d une seule.
Aujourd hui tout tourne bien mais le soucis est cet affichage sur une seule colonne.
Comment dois je modifier le code que voici pour y arriver?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <table width="100%" border="0" cellspacing="0" cellpadding="0" class="box{$data->k}">
<tr>
<td width="{$thumbwidth}" valign="top" rowspan="2">{$data->thumbnail}</td>
<td width="*" valign="top">
<div class="avatar">{$data->avatar}</div>
<div style="float:right;text-align:right;">
{$data->groupmembership}
{$data->reportgroup}
</div>
<div class="listtitle">{$data->grouptitle} {$data->editgroup} {$data->deletegroup}</div>
<div class="listdesc">{$data->groupdescription}</div>
<div class="listgroupdetails">{$smarty.const._HWDVIDS_INFO_TOTMEM}: {$data->totalmembers} |
{$smarty.const._HWDVIDS_INFO_TOTVID}: {$data->totalvideos} |
{$smarty.const._HWDVIDS_INFO_CREATEDBY} {$data->administrator}
</div>
</td>
</tr>
</table> |
Je vous remercie de votre aide par avance.
Cordialement,
Sebastien
Solution en partie trouvée
Bon j ai quasiment réussi en modifiant deux fichiers.
Le premier est celui qui appelle l affichage, nous le nommerons index.tpl
Le second est celui qui génère le format d affichage,nous le nommerons video_list.tpl
J ai quasiment réussi a avoir mon affichage niquel mais il reste encore un soucis: les miniatures des vidéos sont répétées une dizaine de fois et toutes les deux lignes j en ai une qui apparait seule...
Voici mes fichiers:
index.tpl
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| {include file="header.tpl"}
{if $print_nowlist}
{include file="video_beingwatched.tpl"}
{/if}
{if $print_featured}
{include file="featured_videos_01.tpl"}
{/if}
{if $print_ads}<div id="hwdadverts">{$advert3}</div>{/if}
<div class="tabber" id="tab1">
<div class="tabbertab">
<h2><a name="tab1">DERNIERES VIDEOS</a></h2>
<div class="recent">
{if $print_videolist}
{foreach name=outer item=data from=$list}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{foreach name=outer item=data from=$list}
<td>
{include file="video_list1.tpl"}
</td>
{if $smarty.foreach.outer.index % 5 == 0}</tr><tr>{/if}
{/foreach}
</tr>
</table>
{/foreach}
{else}
<div class="padding">{$smarty.const._HWDVIDS_INFO_NRV}</div>
{/if}
{$pageNavigation}
</div>
</div>
{if $print_mostviewed}
<div class="tabbertab">
<h2><a name="tab1">VIDEOS LES PLUS REGARDEES</a></h2>
<div class="recent">
{foreach name=outer item=data from=$mostviewedlist}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{foreach name=outer item=data from=$list}
<td>
{include file="video_list1.tpl"}
</td>
{if $smarty.foreach.outer.index % 5 == 0}</tr><tr>{/if}
{/foreach}
</tr>
</table>
{/foreach}
</div>
</div>
{/if}
{if $print_mostfavoured}
<div class="tabbertab">
<h2><a name="tab1">VIDEOS FAVORITES</a></h2>
<div class="recent">
{foreach name=outer item=data from=$mostfavouredlist}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{foreach name=outer item=data from=$list}
<td>
{include file="video_list1.tpl"}
</td>
{if $smarty.foreach.outer.index % 5 == 0}</tr><tr>{/if}
{/foreach}
</tr>
</table>
{/foreach}
</div>
</div>
{/if}
{if $print_mostpopular}
<div class="tabbertab">
<h2><a name="tab1">VIDEOS LES PLUS POPULAIRES</a></h2>
<div class="recent">
{foreach name=outer item=data from=$mostpopularlist}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{foreach name=outer item=data from=$list}
<td>
{include file="video_list1.tpl"}
</td>
{if $smarty.foreach.outer.index % 5 == 0}</tr><tr>{/if}
{/foreach}
</tr>
</table>
{/foreach}
</div>
</div>
{/if}
</div>
<script type="text/javascript">tabberAutomatic();</script>
{include file="footer.tpl"} |
et voici mon fichier
video_list.tpl
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <table width="100%" border="0" cellspacing="0" cellpadding="0" class="box{$data->k}">
<tr>
<td width="{$thumbwidth}" valign="top">{$data->thumbnail}</td>
<td width="" valign="top">
<div class="avatar">{$data->avatar}</div>
<div class="listtitle">{$data->title} {$data->editvideo} {$data->deletevideo}</div>
<div class="listcat">{$smarty.const._HWDVIDS_INFO_CATEGORY}: {$data->category}</div>
<div class="listdesc">{$data->description}</div>
</td>
<td width="150" valign="top">
<div class="listrating">{$data->rating}</div>
<div class="listviews">{$smarty.const._HWDVIDS_INFO_VIEWS}: {$data->views}</div>
<div class="listduration">{$smarty.const._HWDVIDS_INFO_DURATION}: {$data->duration}</div>
<div class="listuploader">{$smarty.const._HWDVIDS_INFO_FROM}: {$data->uploader}</div>
</td>
</tr>
</table> |
Pouvez vous me dire ou est mon erreur?
Cordialement,
Sebastien