Php datei nur Link und Titel anzeige

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Php datei nur Link und Titel anzeige

    Sorry Jungz wusste nicht wie ich es beschreiben soll gg


    Habe folgendes Problem

    ich möchte das diese Datei die ich hier poste nur den Titel mit Link ausgibt. Was muss ich weglassen bzw was muss übrig bleiben?


    Momentan gibt diese Script mehrere Sachen aus wie: Name, gepostet am, Voten, ID, Beschreibung, Fromat etc.
    Also wie gesagt ich möchte das Sie nur ausgibt

    Titel und LINK

    Quellcode

    1. <?
    2. #################################################
    3. # xLinks 2002 #
    4. #################################################
    5. # © by Robert Klikics | http://x-dev.de #
    6. # eMail: rob@x-dev.de #
    7. #################################################
    8. # License: GPL #
    9. # please don't remove this copyright - thx #
    10. #################################################
    11. # FILE: view.php #
    12. #################################################
    13. // die if !$cat
    14. if(!$cat) die("<h4>Script says: \"I need a category to show!!!\" ");
    15. #======================================================================#
    16. # the includes & mySQL-conn
    17. #======================================================================#
    18. require("./inc/conf.inc.php"); // cfg
    19. require("./inc/connect.php"); // mySQL
    20. require("./lang/$language"); // language-file
    21. include("./inc/head.inc"); // header
    22. //set table-vars
    23. $table_linkdata = $db_prefix."linkdata";
    24. $table_cat = $db_prefix."cat";
    25. $table_votes = $db_prefix."votes";
    26. $table_languages = $db_prefix."languages";
    27. //Connect to mySQL
    28. $conn = @MYSQL_CONNECT($server, $user, $pass);
    29. //Select DB
    30. @MYSQL_SELECT_DB($mydb) or die ("<h1>Database '$mydb' does not exist or mySQL is not connected!<p>Please check your settings ...</h1>");
    31. //Check
    32. if(!$conn) die("<h1>mySQL-Connection-Error<br>Check your settings ...</h1>");
    33. #======================================================================#
    34. # add vote to db & check if already voted
    35. #======================================================================#
    36. if($yourvote)
    37. {
    38. //save vote in db
    39. $sql = "INSERT INTO $table_votes (vote, link_id, cat)";
    40. $sql.= "VALUES ('$yourvote', '$id', '$cat')";
    41. MYSQL_QUERY($sql);
    42. //vote counter +1
    43. MYSQL_QUERY("UPDATE $table_linkdata SET hp_votes = hp_votes + 1 WHERE id = $id");
    44. // generate actual vote-count and put into "LINKDATA-->hp_votes"
    45. $result = MYSQL_QUERY("SELECT vote FROM $table_votes WHERE link_id = $id");
    46. $anzahl = MYSQL_NUM_ROWS($result);
    47. while ($row = MYSQL_FETCH_ARRAY($result)) { $allvotes = $allvotes + $row[vote]; } // summary of votes for an id
    48. if($anzahl == 1) $allvotes = $yourvote; // set $allvotes to 1, if it's the first one
    49. $av_votes = round($allvotes / $anzahl, 1); // get & round the average-votes
    50. // put $av_votes to db
    51. MYSQL_QUERY("UPDATE $table_linkdata SET hp_vote = $av_votes WHERE id = $id");
    52. // show auto-link if vote added
    53. echo <<<end_xx
    54. <meta http-equiv="refresh" content="2; URL=$PHP_SELF?cat=$cat&s=$s">
    55. <table width="100%" border="0" cellspacing="3" cellpadding="3" height="95%">
    56. <tr valign="middle" align="center">
    57. <td>
    58. end_xx;
    59. echo "\n<font size='2'>".VIEW_VOTE_AUTOLINK."</b>\n";
    60. echo "<p>[ <a href='$PHP_SELF?cat=$cat&s=$s'>link</a> ]";
    61. echo <<<end_x
    62. </td>
    63. </tr>
    64. </table>
    65. </body>
    66. </html>
    67. end_x;
    68. exit;
    69. } // endif $yourvote
    70. #======================================================================#
    71. # get data from db by right order ...
    72. #======================================================================#
    73. if(($cat) && (!$yourvote))
    74. {
    75. if($sort == "new" || $incatsort == "id") { $incatsort = "id"; $sortby = "DESC"; $act_sort = VIEW_SORTING_NEW; } // sorting by old/new
    76. if($sort == "old") { $incatsort = "id"; $sortby = "ASC"; $act_sort = VIEW_SORTING_OLD; }
    77. if($sort == "vote" || $incatsort == "hp_vote") { $incatsort = "hp_vote"; $sortby = "DESC"; $act_sort = VIEW_SORT_BY_VOTE; } //sort by rating
    78. if($sort == "hits" || $incatsort == "hp_votes") { $incatsort = "Hits"; $sortby = "DESC"; $act_sort = VIEW_SORT_BY_HITS; } //sort by hits
    79. if($sort == "name" || $incatsort == "name") { $incatsort = "name"; $sortby = "ASC"; $act_sort = VIEW_SORTING_NAME; } //sort by name
    80. //when searching
    81. if($cat == "search") {
    82. $result = MYSQL_QUERY("SELECT * FROM $table_linkdata WHERE name LIKE \"%$q%\" order by $incatsort $sortby LIMIT 0,$max_search "); // get seach-query's to $max_search
    83. $scnt = MYSQL_NUM_ROWS($result);
    84. } else {
    85. if(!$s) { $showfrom = 0; $datasets = $perpage; // params for default--output (on 1 page)
    86. } else {
    87. $showfrom = $s; $datasets = $perpage; } // set params for page--output (multiple pages)
    88. // get total number of links in a cat
    89. $countz = MYSQL_QUERY("SELECT COUNT(id) FROM $table_linkdata WHERE cat = $cat ");
    90. $anz = MYSQL_RESULT($countz,0);
    91. MYSQL_FREE_RESULT($countz); //mem
    92. $result = MYSQL_QUERY("SELECT * FROM $table_linkdata WHERE cat = $cat order by $incatsort $sortby LIMIT $showfrom,$datasets "); //get linkdata
    93. } //endif $search
    94. #======================================================================#
    95. # javascript for jump-menu
    96. #======================================================================#
    97. ?>
    98. <script language='javascript'>
    99. <!--
    100. // jump-menu
    101. function jumper(targ,selObj,restore)
    102. {
    103. eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    104. if (restore) selObj.selectedIndex=0;
    105. }
    106. //-->
    107. </script>
    108. <p>
    109. <table width="100%" border="0" cellspacing="3" cellpadding="3" height="95%">
    110. <tr valign="middle" align="center">
    111. <td>
    112. <table border='0' cellspacing='1' cellpadding='1' align='center' width='<?=$linkwidth?>'>
    113. <tr>
    114. <td align='center'>
    115. <?
    116. #======================================================================#
    117. # render cat-info & some NAVI-links
    118. #======================================================================#
    119. if($cat != "search") //show not if searching
    120. {
    121. $hello = MYSQL_QUERY("SELECT * FROM $table_cat WHERE id = $cat"); // get cat-info
    122. $world = MYSQL_FETCH_ARRAY($hello);
    123. echo "\n\n<!-- powered by xLinks [ © http://x-dev.de - get it there ] -->\n\n";
    124. echo "<h4>$listname | ".VIEW_BEFORE_CAT_TXT." '$world[name]'</h4>\n"; // print cat-info
    125. echo "</td>\n</tr>\n";
    126. MYSQL_FREE_RESULT($hello); // give memory free
    127. } else {
    128. echo "<h4>$listname | ".SEARCH_RESULTS." $q ($max_search max.)</h4>\n"; } // print search-resluts header
    129. #======================================================================#
    130. # render output-table for each link
    131. #======================================================================#
    132. if(!$scnt && $cat == "search") echo SEARCH_NO_RESULTS; // msg if no search-results found
    133. //function to generate the <select>-field for 'vote'
    134. function VoteSelect()
    135. {
    136. global $PHP_SELF;
    137. global $cat;
    138. global $row;
    139. global $s;
    140. // <select> for vote
    141. echo "\t<select name='a_vote' onchange=\"jumper('self',this,0)\">\n";
    142. echo "\t<option>".VIEW_VOTE_SELECT."\n";
    143. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=1'>1 - ".VIEW_BADDEST_VOTE."\n";
    144. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=2'>2\n";
    145. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=3'>3\n";
    146. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=4'>4\n";
    147. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=5'>5\n";
    148. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=6'>6\n";
    149. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=7'>7\n";
    150. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=8'>8\n";
    151. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=9'>9\n";
    152. echo "\t<option value='$PHP_SELF?cat=$cat&id=$row[id]&s=$s&yourvote=10'>10 - ".VIEW_BEST_VOTE."\n";
    153. echo "\t</select>\n";
    154. }
    155. while ($row = MYSQL_FETCH_ARRAY($result))
    156. {
    157. // get date of posting and format as set
    158. if($timeformat == 1) $pd = strftime("%d.%m.%Y", $row[poster_time]);
    159. elseif($timeformat == 2) $pd = strftime("%A, %d-%m-%Y %R", $row[poster_time]);
    160. elseif($timeformat == 3) $pd = strftime("%d-%m-%Y", $row[poster_time]);
    161. else $pd = strftime("%Y-%d-%m", $row[poster_time]);
    162. //strip-slashes
    163. if($html == "ON")
    164. {
    165. $row[hp_desc] = stripslashes($row[hp_desc]);
    166. $row[name] = stripslashes($row[name]);
    167. $row[url] = stripslashes($row[url]);
    168. $row[poster_name] = stripslashes($row[poster_name]);
    169. $row[poster_email] = stripslashes($row[poster_email]);
    170. }
    171. // include design.inc.php and render table's
    172. include("inc/design.inc.php");
    173. }
    174. MYSQL_FREE_RESULT($result); // give memory free
    175. } //endif $cat
    176. ?>
    177. <br>
    178. <table border='0' align='center' width='<?=$linkwidth?>'>
    179. <tr>
    180. <td align='left'><a href='javascript:scroll(0,0)'><?=VIEW_LINK_TOP;?></a></td>
    181. <td align='right'>
    182. <?
    183. // <select> for catjump
    184. echo VIEW_CATJUMP_SEL."&nbsp;";
    185. echo "<select name='mycatisjumping' onchange=\"jumper('self',this,0)\" onmouseover='this.focus()'>\n";
    186. echo "<option value=''>".ADD_HP_CAT_SELECT."\n";
    187. $sweet = MYSQL_QUERY("SELECT * FROM $table_cat order by $catorder");
    188. while ($cats = MYSQL_FETCH_ARRAY($sweet))
    189. {
    190. if($cats[id] != $cat) echo "<option value='$PHP_SELF?cat=$cats[id]&sort=$sort'>$cats[name]\n"; // render cat-selection
    191. }
    192. MYSQL_FREE_RESULT($sweet); // give memory free
    193. echo "</select>\n";
    194. ?>
    195. </td>
    196. </tr>
    197. </table>
    198. <br>
    199. <table border='0' align='center' width='<?=$linkwidth?>'>
    200. <tr>
    201. <td align='center'>
    202. <?
    203. #======================================================================#
    204. # navigation @ page bottom of the cat-view
    205. # (only if not searching)
    206. #======================================================================#
    207. if($cat != "search")
    208. {
    209. //var's
    210. $ges = $anz / $perpage;
    211. if(is_integer($ges)) $pgcnt = $ges;
    212. else $pgcnt = $ges + 1; // get page-counter in a cat
    213. //$lastpg = $anz - $perpage; // $s of last page
    214. $actpg = $s / $perpage + 1; // get number of actual page
    215. $sh_to = $showfrom + $perpage; // $s for next page
    216. $sh_strt = $showfrom - $perpage; // $s for prev. page
    217. if($sh_to > $anz) $sh_to = $anz; // ---- "" ----
    218. if($sort) $linkvar = "&sort=$sort"; // string for sorting if set
    219. //output
    220. if($s) echo "[ <a href='$PHP_SELF?cat=$cat&s=$sh_strt$linkvar'><</a> ] ::\n";
    221. echo "<b>[</b> ".VIEW_LINKS_PAGE." $actpg ".VIEW_LINKS_FROM." ".sprintf("%d","$pgcnt")." <b>]</b> ";
    222. if($s + $perpage < $anz) echo ":: [ <a href='$PHP_SELF?cat=$cat&s=$sh_to$linkvar'>></a> ]\n";
    223. } //endif $q
    224. // HTML:
    225. ?>
    226. </td>
    227. </tr>
    228. </table>
    229. </td>
    230. </tr>
    231. </table>
    232. <?
    233. #======================================================================#
    234. # footer &
    235. # END OF FILE
    236. #======================================================================#
    237. // PLEASE DONT CHANGE THIS [for dev]
    238. #################################################################################################################
    239. echo "\n<!-- some copyright, please don't remove :: thank you [ http://x-dev.de ] -->\n"; #
    240. echo "\n<p align='center'>&copy; <a href='jump.php?id=x' target='_blank'>xLinks</a> 2002\n"; # #
    241. //disconnect from mySQL #
    242. MYSQL_CLOSE(); #
    243. #################################################################################################################
    244. include("./inc/foot.inc");
    245. ?>
    Alles anzeigen


    Danke für eure Mühe
  • wow, man soll nicht schlecht über Andere reden, aber wenn der Code dir wäre, dann würde ich dir sagen, dass der Code einen extrem schlechten Stil hat!

    das include (in der while Schleife) wird das design enthalten. Da musst du die entsprechenden Ausgaben löschen. Das wirst du vermutlich selbst hinbekommen.

    Generell sollte es dir keine Probleme machen, ausfindig zu machen, wo was ausgeben wird.
  • Ok danke jungz kann mir aber mal jemand sagen wieso es jetzt nur im Internet Explorer korrekt angezeigt wird und im Mozilla Browser nicht

    Im Mozilla springt er nach jedem 12ten Titel Zeichen in die nächst Zeile

    das ist der Code den ich jetzt so bearbeitet habe

    Quellcode

    1. <?
    2. // render output-table
    3. echo "\n<br>\n";
    4. echo "\n<!-- TABLE FOR ID #$row[id] -->\n";
    5. echo "<table border='0' cellspacing='1' cellpadding='1' align='center' width='500' id='view_unique_table'>\n";
    6. echo "\t<tr>\n\t<td colspan='3'>\n\t".NAME_MARKER_FOR_VIEW."<a href='jump.php?id=$row[id]' target='_blank'><font size='2'><b>$row[name]</b></font></a>\n\t</td>\n\t<td align='right'>ID $row[id]\n\t</td>\n\t</tr>\n";
    7. echo "\t<tr>\n\t<td id='view_desc_td' colspan='5'>\n\t$row[hp_desc]\n\t</td>\n\t</tr>\n";
    8. echo "\t<tr>\n";
    9. echo "\t<td width='25%'>".VIEW_HITS_TXT." <b>$row[Hits]</b></td>\n";
    10. echo "\t</td>\n";
    11. echo "\t</tr>\n";
    12. echo "</table>\n";
    13. // end output-table
    14. ?>
    Alles anzeigen



    und das ist der Original Code

    Quellcode

    1. <?
    2. // render output-table
    3. echo "\n<br>\n";
    4. echo "\n<!-- TABLE FOR ID #$row[id] -->\n";
    5. echo "<table border='0' cellspacing='1' cellpadding='1' align='center' width='$linkwidth' id='view_unique_table'>\n";
    6. echo "\t<tr>\n\t<td colspan='3'>\n\t".NAME_MARKER_FOR_VIEW."<a href='jump.php?id=$row[id]' target='_blank'><font size='2'><b>$row[name]</b></font></a>\n\t</td>\n\t<td align='right'>ID $row[id]\n\t</td>\n\t</tr>\n";
    7. echo "\t<tr>\n\t<td colspan='5'>\n\t<b>".URL_MARKER_FOR_VIEW."</b> <a href='jump.php?id=$row[id]' target='_blank'>$row[url]</a> <b>".URL_MARKER_FOR_VIEW."</b> $row[hp_lang] <b>".URL_MARKER_FOR_VIEW."</b> ".VIEW_ADDED_LINK." $pd\n\t</td>\n\t</tr>\n";
    8. echo "\t<tr>\n\t<td id='view_desc_td' colspan='5'>\n\t$row[hp_desc]\n\t</td>\n\t</tr>\n";
    9. echo "\t<tr>\n";
    10. echo "\t<td width='25%'>".VIEW_HITS_TXT." <b>$row[Hits]</b></td>\n";
    11. echo "\t<td width='25%'>".VIEW_VOTE_TXT." <b>$row[hp_vote]</b> ($row[hp_votes] ".VIEW_VOTES_TXT.")</td>\n";
    12. echo "\t<td width='25%'>".VIEW_POSTED_BY." <a href='mailto:$row[poster_email]'>$row[poster_name]</a></td>\n";
    13. echo "\t<td width='25%' align='right'>\n";
    14. VoteSelect(); //function to render <select>
    15. echo "\t</td>\n";
    16. echo "\t</tr>\n";
    17. echo "</table>\n";
    18. // end output-table
    19. ?>
    Alles anzeigen