Tato123 Posted February 4, 2014 Report Posted February 4, 2014 Hi Guys, i have a problem <?php if(!$allawardtpes) { echo 'Non sono disponibili Spille!'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <p> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'Nessuna Spilla Assegnata'; $allissuedawards = array(); } foreach($allissuedawards as $award) { ?> <?php if(!empty($award->awd_image)) { ?> <br /> <table> <th><img src="<?php echo $award->awd_image;?>" /><th> <th><?php echo $award->awd_name;?></th> </table> <?php } else { ?> Immagine Spilla non disponibile <?php } ?> </p> <?php } ?> <?php } ?> With this code, I create a table where each row corresponds to a given award example: A award B award C award D award E award F award I would like to create the table in this way: Aaward Baward Caward Daward Eaward Faward Can anyone help me? Quote
CustomCoders Posted February 4, 2014 Report Posted February 4, 2014 You could always just use a <div>. <div id="awards" style="float:left;text-align:center;"> <img src="<?php echo $award->awd_image;?>" /> <br> <?php echo $award->awd_name;?> </div> Cheers. --- Ross P. Quote
Tato123 Posted February 5, 2014 Author Report Posted February 5, 2014 Hi, thanks for help I try with this code: <?php if(!$allawardtpes) { echo 'Non sono disponibili Spille!'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'Nessuna Spilla Assegnata'; $allissuedawards = array(); } foreach($allissuedawards as $award) { ?> <?php if(!empty($award->awd_image)) { ?> <br /> <table> <div id="awards" style="float:left;text-align:left;"><img src="<?php echo $award->awd_image;?>" /></div> </table> <?php } else { ?> Immagine Spilla non disponibile <?php } ?> <?php } ?> <?php } ?> But the result is not good Do yuo have any suggestion? Thanks Quote
CustomCoders Posted February 5, 2014 Report Posted February 5, 2014 (edited) - Edited November 20, 2022 by CustomCoders Quote
Tato123 Posted February 5, 2014 Author Report Posted February 5, 2014 I try with <div style="clear:both"> but don't work Anybody have a idea? Quote
Moderators servetas Posted February 5, 2014 Moderators Report Posted February 5, 2014 Can you check if this works? <?php if(!$allawardtpes) { echo 'No category available'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'No issued awards'; $allissuedawards = array(); } foreach($allissuedawards as $award) { ?> <?php if(!empty($award->awd_image)) { ?> <br /> <p align="center"><img src="<?php echo $award->awd_image;?>" /></p> <?php } else {echo 'No Image available';} } ?> <?php } ?> Quote
Tato123 Posted February 5, 2014 Author Report Posted February 5, 2014 Hi Scott, yes work. All image are in the center of the page. Quote
Moderators servetas Posted February 5, 2014 Moderators Report Posted February 5, 2014 BTW, George You may use this if you want to place them on the same line: <?php if(!$allawardtpes) { echo 'No category available'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'No issued awards'; $allissuedawards = array(); } foreach($allissuedawards as $award) { ?> <?php if(!empty($award->awd_image)) { ?> <p align="center"><img src="<?php echo $award->awd_image;?>" /></p> <?php } else {echo 'No Image available';} } ?> <?php } ?> Quote
Tato123 Posted February 5, 2014 Author Report Posted February 5, 2014 Thanks Servetas but for use the float function? Quote
Moderators servetas Posted February 5, 2014 Moderators Report Posted February 5, 2014 What do you mean? Quote
Tato123 Posted February 5, 2014 Author Report Posted February 5, 2014 please read the first my post Quote
Moderators servetas Posted February 5, 2014 Moderators Report Posted February 5, 2014 I do not know if this is possible. Please wait if anyone else know anything about it. Quote
Members Vangelis Posted February 7, 2014 Members Report Posted February 7, 2014 Voila echo "<table>"; echo "<tr>" ; $i = 0; foreach ($allawards as $award) { if ($i % 3 === 0) { echo '</tr><tr>'; } echo "<td><img src=".$award->image." alt=".$award->descrip." /> </td>"; $i++; } echo "</tr>" ; echo "</table> "; Try this it is fixed for 3 rows but if you want more or less change the number 3 to your choise at if ($i % 3 === 0) Quote
Tato123 Posted February 8, 2014 Author Report Posted February 8, 2014 thanks Vangelis, but don't work. Where i put your code? My original code is: <?php if(!$allawardtpes) { echo 'Non sono disponibili Spille!'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <p> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'Nessuna Spilla Assegnata'; $allissuedawards = array(); } foreach($allissuedawards as $award) { ?> <?php if(!empty($award->awd_image)) { ?> <br /> <table> <th><img src="<?php echo $award->awd_image;?>" /><th> <th><?php echo $award->awd_name;?></th> </table> <?php } else { ?> Immagine Spilla non disponibile <?php } ?> </p> <?php } ?> <?php } ?> Quote
Members Vangelis Posted February 8, 2014 Members Report Posted February 8, 2014 Copy and paste this over your code and see if it works My code didnt worked for you because i didnt saw that you are not using $allawards but $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); If the code below is not working please tell me in witch page or template do you want to show it and if you are using a custom awards module because the build in module for awards does not require you to do $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); in the template in order to show the pilot awards <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) echo 'Nessuna Spilla Assegnata'; else{ echo "<table>"; echo "<tr>" ; $i = 0; foreach ($allissuedawards as $award) { if ($i % 3 === 0) { echo '</tr><tr>'; } echo "<td><img src=".$award->image." alt=".$award->descrip." /> </td>"; $i++; } echo "</tr>" ; echo "</table> "; } Quote
Tato123 Posted February 9, 2014 Author Report Posted February 9, 2014 Hi Vangelis, don't work. I put this code in profile_main.tpl <?php MainController::Run('vAwards', 'showPilotIssuedAwards', $userinfo->pilotid); ?> I use the freeware module Vawards from Vansers Quote
Members Vangelis Posted February 9, 2014 Members Report Posted February 9, 2014 Copy and paste this over your's in /templates/profile_issued_awards.tpl <?php if(!$allawardtpes) { echo 'There is no awards available!'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'Nessuna Spilla Assegnata'; $allissuedawards = array(); } echo "<table>"; echo "<tr>" ; $i = 0; foreach($allissuedawards as $award) { if ($i % 3 === 0) { echo '</tr><tr>'; } echo "<td><img src=".$award->awd_image." alt=".$award->descrip." /> <br /><strong>Award Name:</strong>".$award->awd_name."<br /></td>"; $i++; } echo "</tr>" ; echo "</table> "; } ?> This is tested with the version that i downloaded 2day from Kyle's github Quote
Tato123 Posted February 9, 2014 Author Report Posted February 9, 2014 working great !!!!!!!!!!!! Thanks Vangelis !!!! Quote
Members Vangelis Posted February 9, 2014 Members Report Posted February 9, 2014 No problem happy that i helped you Quote
ercio Posted April 27, 2016 Report Posted April 27, 2016 <?php if(!$allawardtpes) { echo 'There is no awards available!'; return; } foreach($allawardtpes as $type) { ?> <h3><?php echo $type->typ_name;?></h3> <?php $allissuedawards = vAwardsData::GetAllIssuedAward($pilotid, $type->typ_id); if(!$allissuedawards) { echo 'Nessuna Spilla Assegnata'; $allissuedawards = array(); } echo "<table>"; echo "<tr>" ; $i = 0; foreach($allissuedawards as $award) { if ($i % 3 === 0) { echo '</tr><tr>'; } echo "<td><img src=".$award->awd_image." alt=".$award->descrip." /> <br /><strong>Award Name:</strong>".$award->awd_name."<br /></td>"; $i++; } echo "</tr>" ; echo "</table> "; } ?> how do i take this tables line off? http://i.imgur.com/KG2IrU7.png Quote
Members Vangelis Posted May 1, 2016 Members Report Posted May 1, 2016 image is not helping can you provide a link ? as this seems to be a css issue Quote
ercio Posted May 10, 2016 Report Posted May 10, 2016 Vangelis Thanks , but the link goes only when you are logged in , the lines I want to take of is this rectangular lines around the awards Quote
web541 Posted May 10, 2016 Report Posted May 10, 2016 (edited) style="border: none;" ? Edited May 10, 2016 by web541 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.