Tom's Guide > Forum > Programmation > Editer un PHP en HTML

Editer un PHP en HTML

Forum Programmation : Editer un PHP en HTML

TomsGuide.com : 800 000 inscrits répondent à toutes vos questions high-tech et informatique. Pour obtenir de l'aide, inscrivez-vous gratuitement !
Mot :    Pseudo :           
 

Bonjour, :hello:
Je souhaite éditer ce script PHP en HTML pour qu'il soit compatible avec mon site web :

Code :
  1. ##############################################################
  2. ## MOD Title: Similar Topics
  3. ## MOD Author: Leuchte < mail@leuchte.net > http://www.leuchte.net
  4. ## MOD Description: This mod adds a table at the bottom of a thread and displays other threads that are silimar in topic.
  5. ##
  6. ## MOD Version: 1.0.1
  7. ##
  8. ## Installation Level: Easy
  9. ## Installation Time: 5 Minutes
  10. ## Files To Edit: 3
  11. ##
  12. ##            lang_main.php
  13. ##            viewtopic.php
  14. ##            templates/subSilver/viewtopic_body.tpl
  15. ##
  16. ## Included Files: 0
  17. ##############################################################
  18. ## For Security Purposes, Please Check: http://www.leuchte.net/mods/ for the
  19. ## latest version of this MOD.
  20. ##
  21. ##############################################################
  22. ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
  23. ##############################################################
  24. ## MOD History:
  25. ##
  26. ##  2004-09-25 - Initial Release
  27. ##
  28. ##############################################################
  29. #
  30. #-----[ SQL ]------------------------------------------
  31. # Run the following command on your sql database (replace phpbb_ with your db prefix) before you edit the files!
  32. ALTER TABLE phpbb_topics ADD FULLTEXT (topic_title);
  33. #
  34. #-----[ OPEN ]------------------------------------------
  35. #
  36. language/lang_english/lang_main.php
  37. #
  38. #-----[ FIND ]------------------------------------------
  39. #
  40. ?>
  41. #
  42. #-----[ BEFORE, ADD ]------------------------------------------
  43. #
  44. $lang['Similar'] = 'Similar Topics';
  45. #
  46. #-----[ OPEN ]------------------------------------------
  47. #
  48. viewtopic.php
  49. #
  50. #-----[ FIND ]------------------------------------------
  51. #
  52. //
  53. // Go ahead and pull all data for this topic
  54. //
  55. #
  56. #-----[ BEFORE, ADD ]------------------------------------------
  57. #
  58. // Similar Topics
  59. $sql = "SELECT topic_id
  60. FROM ". TOPICS_TABLE ."
  61. WHERE topic_id != $topic_id
  62. AND MATCH (topic_title) AGAINST ('". addslashes($topic_title) ."')
  63. ORDER BY topic_time DESC LIMIT 0,5";
  64. if ( !($result = $db->sql_query($sql)) )
  65. {
  66.     message_die(GENERAL_ERROR, "Could not get main information for similar topics", '', __LINE__, __FILE__, $sql);
  67. }
  68. $topics = array();
  69. while ( $row = $db->sql_fetchrow($result) )
  70. {
  71.   $topics[] = $row;
  72. }
  73.   $count_similar = count($topics);
  74. if ( $count_similar > 0 )
  75. {
  76.   $template->assign_block_vars('similar', array(
  77.         'L_SIMILAR' => $lang['Similar'],
  78.         'L_TOPIC' => $lang['Topic'],
  79.         'L_AUTHOR' => $lang['Author'],
  80.         'L_FORUM' =>  $lang['Forum'],
  81.         'L_REPLIES' => $lang['Replies'],
  82.         'L_LAST_POST' => $lang['Posted'])
  83.   );
  84.  
  85. for($i = 0; $i < $count_similar; $i++)
  86. {
  87.   $sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
  88.   FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
  89.   WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
  90.   AND f.forum_id = t.forum_id
  91.   AND p.topic_id = t.topic_id
  92.   AND u.user_id = p.poster_id
  93.   GROUP BY t.topic_id";
  94. if ( !($result = $db->sql_query($sql)) )
  95. {
  96.       message_die(GENERAL_ERROR, "Could not get similar topics", '', __LINE__, __FILE__, $sql);
  97. }
  98.  
  99.   while ( $row = $db->sql_fetchrow($result) )
  100.   {
  101.   $similar = $row;
  102.  
  103.   $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) : array();
  104.   $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) : array();
  105.   $topic_type =  ( $similar['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
  106.      $topic_type .= ( $similar['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
  107.      $topic_type .= ( $similar['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';
  108.   $replies = $similar['topic_replies'];
  109.  
  110.   if( $similar['topic_status'] == TOPIC_LOCKED )
  111.     {
  112.         $folder = $images['folder_locked'];
  113.         $folder_new = $images['folder_locked_new'];
  114.     }
  115.     else if( $similar['topic_type'] == POST_ANNOUNCE )
  116.     {
  117.         $folder = $images['folder_announce'];
  118.         $folder_new = $images['folder_announce_new'];
  119.     }
  120.     else if( $similar['topic_type'] == POST_GLOBAL_ANNOUNCE )
  121.     {
  122.         $folder = $images['folder_global_announce'];
  123.         $folder_new = $images['folder_global_announce_new'];
  124.     }
  125.     else if( $similar['topic_type'] == POST_STICKY )
  126.     {
  127.         $folder = $images['folder_sticky'];
  128.         $folder_new = $images['folder_sticky_new'];
  129.     }
  130.     else
  131.     {
  132.         if( $replies >= $board_config['hot_threshold'] )
  133.         {
  134.             $folder = $images['folder_hot'];
  135.             $folder_new = $images['folder_hot_new'];
  136.         }
  137.         else
  138.         {
  139.             $folder = $images['folder'];
  140.             $folder_new = $images['folder_new'];
  141.         }
  142.     }
  143.   if( $userdata['session_logged_in'] )
  144.     {
  145.         if( $similar['post_time'] > $userdata['user_lastvisit'] )
  146.         {
  147.             if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )
  148.             {
  149.                 $unread_topics = true;
  150.                 if( !empty($tracking_topics[$topic_id]) )
  151.                 {
  152.                     if( $tracking_topics[$topic_id] >= $similar['post_time'] )
  153.                     {
  154.                         $unread_topics = false;
  155.                     }
  156.                 }
  157.                 if( !empty($tracking_forums[$forum_id]) )
  158.                 {
  159.                     if( $tracking_forums[$forum_id] >= $similar['post_time'] )
  160.                     {
  161.                         $unread_topics = false;
  162.                     }
  163.                 }
  164.                 if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )
  165.                 {
  166.                     if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all'] >= $similar['post_time'] )
  167.                     {
  168.                         $unread_topics = false;
  169.                     }
  170.                 }
  171.                 if( $unread_topics )
  172.                 {
  173.                     $folder_image = $folder_new;
  174.                     $folder_alt = $lang['New_posts'];
  175.                     $newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&amp;view=newest" ) .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';
  176.                 }
  177.                 else
  178.                 {
  179.                     $folder_image = $folder;
  180.                     $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
  181.                     $newest_img = '';
  182.                 }
  183.             }
  184.             else
  185.             {
  186.                 $folder_image = $folder_new;
  187.                 $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];
  188.                 $newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&amp;view=newest" ) .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';
  189.             }
  190.         }
  191.         else
  192.         {
  193.             $folder_image = $folder;
  194.             $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
  195.             $newest_img = '';
  196.         }
  197.     }
  198.     else
  199.     {
  200.         $folder_image = $folder;
  201.         $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
  202.         $newest_img = '';
  203.     }
  204.   $title = (strlen($similar['topic_title']) > 40) ? (substr($similar['topic_title'], 0, 37) . '...') : $similar['topic_title'];
  205.   $topic_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL .'='. $similar['topic_id']) .'">'. $title . '</a>';
  206.   $author_url = append_sid("profile.$phpEx?mode=viewprofile&amp;". POST_USERS_URL .'='. $similar['user_id']);
  207.   $author = ( $similar['user_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&amp;". POST_USERS_URL .'='. $similar['user_id']) .'">'. $similar['username'] .'</a>' : ( ($similar['post_username'] != '' ) ? $similar['post_username'] : $lang['Guest'] );
  208.  
  209.   $forum_url = append_sid("viewforum.$phpEx?f=". $similar['forum_id']); 
  210.   $forum = '<a href="'. $forum_url .'">'. $similar['forum_name'] .'</a>';
  211.   $post_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL .'='. $similar['topic_last_post_id']) .'#'. $similar['topic_last_post_id'] .'"><img src="'. $images['icon_latest_reply'] .'" alt="'. $lang['View_latest_post'] .'" title="'. $lang['View_latest_post'] .'" border="0" /></a>';
  212.   $post_time = create_date($board_config['default_dateformat'], $similar['topic_time'], $board_config['board_timezone']);
  213.     $template->assign_block_vars('similar.topics', array(
  214.         'FOLDER' => $folder_image,
  215.         'ALT' => $folder_alt,
  216.         'TYPE' => $topic_type,
  217.         'TOPICS' => $topic_url,
  218.         'AUTHOR' => $author,
  219.         'FORUM' => $forum,
  220.         'REPLIES' => $replies,
  221.         'NEWEST' => $newest_img,
  222.         'POST_TIME' => $post_time,
  223.         'POST_URL' => $post_url)
  224.     );
  225.   } // while
  226. } // for $i
  227. } // if ( $count_similar > 0 )
  228. #
  229. #-----[ OPEN ]------------------------------------------
  230. #
  231. templates/subSilver/viewtopic_body.tpl
  232. #
  233. #-----[ FIND ]------------------------------------------
  234. #
  235.     <td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
  236.   </tr>
  237. </table>
  238. #
  239. #-----[ REPLACE, WITH ]------------------------------------------
  240. #
  241.     <td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
  242.   </tr>
  243.       <tr>
  244.   <td width="100%" colspan="2" align="center">
  245.   <br />
  246. <!-- BEGIN similar -->
  247. <table width="85%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
  248. <tr>
  249.   <td class="catHead" colspan="6"><span class="genmed"><b>{similar.L_SIMILAR}</b></span></td>
  250. </tr>
  251. <tr>
  252.   <th colspan="2">{similar.L_TOPIC}</th>
  253.   <th>{similar.L_AUTHOR}</th>
  254.   <th>{similar.L_FORUM}</th>
  255.   <th>{similar.L_REPLIES}</th>
  256.   <th>{similar.L_LAST_POST}</th>
  257. </tr>
  258. <!-- BEGIN topics -->
  259. <tr>
  260.   <td class="row1" align="center"><span class="genmed"><img src="{similar.topics.FOLDER}" border="0" alt="{similar.topics.ALT}" title="{similar.topics.ALT}" /></span></td>
  261.   <td class="row1" width="30%">{similar.topics.NEWEST}<span class="gensmall">{similar.topics.TYPE}</span> <span class="topictitle">{similar.topics.TOPICS}</span></td>
  262.   <td class="row1" width="10%"><span class="genmed">{similar.topics.AUTHOR}</span></td>
  263.   <td class="row1"><span class="genmed">{similar.topics.FORUM}</span></td>
  264.   <td class="row1" width="15%" align="center"><span class="genmed">{similar.topics.REPLIES}</span></td>
  265.   <td class="row1"><span class="genmed">{similar.topics.POST_TIME} {similar.topics.POST_URL}</span></td>
  266. </tr>
  267. <!-- END topics -->
  268. </table>
  269. <!-- END similar -->
  270.   </td>
  271.   </tr>
  272. </table>
  273. #
  274. #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
  275. #
  276. # EoM


[#ff8d00]Merci beaucoup ![/#7f007f]
:bounce:
A bientôt
@+

Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.

apparemment il te manque quelques bases..
petite présentation de php: http://fr.wikipedia.org/wiki/PHP:_ [...] eprocessor
petite présentation de html: http://fr.wikipedia.org/wiki/Html
ton script se connecte à une base de données, ce que ne sait pas faire html.. (juste en regardant la première ligne)
le plus simple est que tu t'inscrive à un hébergement avec php, ça existe en gratuit..

Répondre à sleepless2101

Genre :
Free.fr
atspace.com
Je crois qu'il y a une liste des hébergements gratuits sur IDN

------------------------------ Gite de Vacances Deux-sèvres (79)
Ragnarok Battle Offline
L'Ouvroir
Répondre à Dawlin

non il n'y en a pas mais sur gratis domaine tu peut avoir un domaine .fr gratuit en 2 mois en lisant les mails tu gagne des points et il t'offre un hébergeur.Mais pour faire ton site web je te conseil d'utiliser IziSpot très bon et gratuit voici un petit site fait avec http://*********/


Message édité par OmaR le 21-10-2008 à 11:22:56
------------------------------ Voici mon site Web:http://afonso93.free.fr
Parrainer moi sur euro barre s.v.p
Répondre à zezire93
Tom's Guide > Forum > Programmation > Editer un PHP en HTML
Aller à :

Il y a 1898 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Attention

Vous allez répondre sur un sujet resté inactif pendant plus de 6 mois.
Assurez-vous d'apporter des éléments nouveaux à la discussion avant de poursuivre.

Répondre Annuler
Liens