Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Przerobienie z <table> na <div>
MisieQHBA
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 12.09.2012

Ostrzeżenie: (0%)
-----


Witajcie, mam do was gorącą prośbe o przerobienie struktóry z <table> na <div> powód? kod ten byl pisany prawie 5 czy nawet więcej lat temu i jest dośc chaotyczny :/

tak wygląda oryginalnie stronka na tabelach
(IMG:http://screenshooter.net/data/uploads/ub/wn/lvoa.jpg)

po mojej jakże daremnej próbie przerobienia na divy wygląda tak (IMG:style_emoticons/default/tongue.gif)
(IMG:http://screenshooter.net/data/uploads/mb/ot/uwxl.jpg)

Zamieszczam wam tutaj czysty kod tzn ten ktory jest oparty na tabelkach (IMG:style_emoticons/default/tongue.gif)

  1. <table>
  2. <tr>
  3. <td align="center" style="padding-bottom: 5px;"><u>Moc</u></td>
  4. <td align="center"><u>Poziom Mocy</u></td>
  5. <td width="60%"><u>Opis Mocy</u></td>
  6. </tr>
  7. <?php
  8.  
  9. // Get the skills for this race
  10. $skills = getSkillsByRace( $p_race_data[$i]->race_id );
  11.  
  12. foreach( $skills as $skill )
  13. {
  14. // Figure out what the skill level is so we can determine the appropriate image!
  15. $skill_level = isset( $p_skill_data[$skill->skill_id] ) ? $p_skill_data[$skill->skill_id] : 0;
  16.  
  17. // Trainable skill
  18. if ( $skill->skill_type == 1 )
  19. {
  20. $skill_level_img = "<img src=\"images/level" . $skill_level . ".gif\" alt=\"Poziom $skill_level\" title=\"Poziom $skill_level\">";
  21. }
  22.  
  23. // Passive skill
  24. else if ( $skill->skill_type == 2 )
  25. {
  26. $skill_level_img = "<img src=\"images/passive" . $race_level . ".gif\" alt=\"Poziom $race_level\" title=\"Poziom $race_level\">";
  27. $skill->skill_description = "Passive, $skill->skill_description";
  28. }
  29.  
  30. // Ultimate
  31. else if ( $skill->skill_type == 3 )
  32. {
  33. $skill_level_img = "<img src=\"images/ultimate" . $skill_level . ".gif\" alt=\"Poziom $skill_level\" title=\"Poziom $skill_level\">";
  34. $skill->skill_description = "Ultimate, $skill->skill_description";
  35. }
  36.  
  37. ?>
  38. <tr>
  39. <td style="padding-top: 5px;">
  40. <center>
  41. <img src="images/war3ft/<?=$skill->skill_id; ?>.gif" alt="<?=$skill->skill_name; ?>" title="<?=$skill->skill_name; ?>"><br>
  42. <span class="text-small">
  43. <?=$skill->skill_name; ?>
  44. </span>
  45. </center>
  46. </td>
  47. <td><?=$skill_level_img; ?></td>
  48. <td style="padding:5px; text-align: left;"><?=$skill->skill_description; ?></td>
  49. </tr>
  50. <?php
  51. }
  52. ?>
  53. </table>


Pozdrawiam i gorąco licze na wasza pomoc ;]

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.09.2025 - 07:24