Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Wyswietlanie poziome
Forum PHP.pl > Forum > Przedszkole
Semaisa
Witam Chodzi mi o to abu zawartosc w pliku byla wyswietlana pozioma , jedno obok drugiej , a nie tak jak jest jedno pod drugim. I mam pyatnie czy mozna do tego wyswietlania dodac opcje przewijania samoczynnego (marquee)
  1. <?
  2. ?>
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6.  
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <script language="JavaScript">
  9. function addsmiley(symbol) {
  10. document.postshout.msg.value += symbol;
  11. document.postshout.msg.focus();
  12. }
  13.  
  14. <!-- Begin
  15. function popUp(URL) {
  16. day = new Date();
  17. id = day.getTime();
  18. eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=300,he
    ight=500');");
  19. }
  20. </script>
  21. <link href="default.css" rel="stylesheet" type="text/css">
  22. </head>
  23.  
  24. <body class="phpshout_body">
  25. <form name="postshout" method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
  26. <table align="center" class="phpshout_table">
  27. <tr>
  28. <td class="phpshout_form"><?
  29. include "config.php";
  30. include "functions.php";
  31. banned_user();
  32.  
  33. if (isset($_POST["Submit"])) {
  34.  
  35.  
  36.  
  37. if (!file_exists("messages.txt")) {
  38.  
  39. echo "<p class="error">Messages.txt doesn't exsist. Please create a file call messages.txt on your server</p>";
  40.  
  41. } else if ($_POST["name"] == "name" || $_POST["msg"] == "message" || $_POST["name"] == NULL || $_POST["msg"] == NULL) {
  42.  
  43. echo "<p class="error"> Steel Radio: Imie oraz tresc sa wymagane - Uzupelnij wszystki pola.</p>";
  44.  
  45. } else {
  46.  
  47. $filename = "messages.txt";
  48. $handle = fopen($filename,"r");
  49. $read = file_get_contents($filename);
  50.  
  51. if ($read != "" || $read != NULL) {
  52.  
  53. $array = split("n", $read);
  54.  
  55. if ($array[0] != NULL || $array[0] != "") {
  56.  
  57. list($name, $msg, $time, $ip) = explode("t", $array[0]);
  58.  
  59. $ip = trim($ip);
  60.  
  61. // Convert timestamp to unix timestamp and get current unix timestamp
  62. $strtime = strtotime($time);
  63. $flood_gate_time = $strtime+$floodtime;
  64. $curtime = time();
  65. $valid = true;
  66. }
  67.  
  68. if ($ip == $_SERVER['REMOTE_ADDR'] && $flood_gate_time > $curtime) {
  69. echo "<p class="error">Steel Radio: Poczekaj ".$floodtime." sekund zanim napiszesz ponownie ! </p>";
  70. } else {
  71.  
  72. writetofile($_POST["name"],$_POST["msg"]);
  73.  
  74. }
  75.  
  76. } else {
  77. writetofile($_POST["name"],$_POST["msg"]);
  78. }
  79.  
  80. } // end if file exists
  81.  
  82. } // end submit
  83.  
  84. ?>
  85. <? 
  86.  
  87. $filename = "messages.txt";
  88.  
  89. if (file_exists($filename)) {
  90.  
  91. $handle = fopen($filename, "r");
  92. $read = file_get_contents($filename);
  93. $array = explode("n", $read);
  94. $x=0;
  95.  
  96. for($i=0; $i<$numofposts; $i++) {
  97.  
  98. if ($array[$i] != NULL || $array[$i] != "") {
  99.  
  100. list($name, $msg, $date, $ip) = explode("t", $array[$i]);
  101.  
  102. $date = str_replace(" ","/",$date);
  103. list($year,$month,$day,$time) = explode("/", $date);
  104.  
  105. // convert text to smilies.
  106. $msg = smiles($msg);
  107.  
  108. // Show date, Yes or No.
  109. if ($showdate == "1") {
  110. $title = "title="Posted ".$day."/".$month."/".$year." ".$time.""";
  111. } else {
  112. $title = "";
  113. }
  114. $x++;
  115. if ( $x % 0 != 0 ) {
  116. echo "<tr><td ".$title." class="phpshout_posts"><strong>".wordwrap($name,18,"<br>n",1)." : </strong>".ereg_replace("([^ /]{22})","1<wbr>",$msg)."</td></tr>";
  117. } else {
  118. echo "<tr><td ".$title." class="phpshout_2nd_posts"><strong>".wordwrap($name,18,"<br>n",1)." : </strong>".ereg_replace("([^ /]{22})","1<wbr>",$msg)."</td></tr>";
  119. }  
  120.  
  121. } else {
  122.  
  123. break;
  124.  
  125. }
  126. }
  127.  
  128. fclose($handle);
  129.  
  130. }
  131.  
  132. ?>
  133. </table>
  134. </form>
  135. </body>
  136. </html>
  137. <?
  138. ?>
vihoo
Nie zagłębiając się zbytnio w kod to chyba chodzi o to:
  1. <?php
  2. echo '<tr>';  
  3. if ( $x % 0 != 0 ) {
  4. echo "<td ".$title." class="phpshout_posts"><strong>".wordwrap($name,18,"<br>n",1)." : </strong>".ereg_replace("([^ /]{22})","1<wbr>",$msg)."</td>";
  5. } else {
  6. echo "<td ".$title." class="phpshout_2nd_posts"><strong>".wordwrap($name,18,"<br>n",1)." : </strong>".ereg_replace("([^ /]{22})","1<wbr>",$msg)."</td>";
  7. } 
  8. echo '</tr>';
  9. ?>

Oprócz tego moim skromnym zdaniem, tabela jest chyba lekko niedopracowna (np brakuje zamnięcia pierwszych znaczników td i tr.
Odpowiedź na drugie pytanie - chyba bez większej modyfikacji sposobu wyświetlania informacji sie nie da.
Semaisa
A moze tą modyfikacje obadamy ?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.