ilch Forum » Allgemein » HTML, PHP, SQL,... » Comments

Geschlossen
  1. #1
    User Pic
    Alienuser Mitglied
    Registriert seit
    21.04.2006
    Beiträge
    826
    Beitragswertungen
    2 Beitragspunkte
    Hallo,

    was muss ich an der Datei ändern, damit man die Comments auf einer anderen Seite machen kann, also von der Seite mit den ausführlichen News, einen Link dann auf die Comments und das auf einer Extra Seite:

    Danke


    Hier der Quellcode von der giganews.php:

    <?php 
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    
    
    $title = $allgAr['title'].' :: Giganews';
    $hmenu = 'Giganews';
    $design = new design ( $title , $hmenu );
    
    
    
    function news_find_kat ($kat) {
        
    		$katpfad = 'include/images/giganews/';
    		$katjpg = $katpfad.$kat.'.jpg';
    		$katgif = $katpfad.$kat.'.gif';
    		$katpng = $katpfad.$kat.'.jpg';
    		
    		if ( file_exists( $katjpg ) ) {
    		  $pfadzumBild = $katjpg;
    		} elseif ( file_exists ( $katgif ) ) {
    		  $pfadzumBild = $katgif;
    		} elseif ( file_exists ( $katpng ) ) {
    		  $pfadzumBild = $katpng;
    		}
    		
    		if ( !empty( $pfadzumBild ) ) {
    			$kategorie = '<img style="" src="'.$pfadzumBild.'" alt="'.$kat.'">';
    		} else {
    		  $kategorie = '<b>'.$kat.'</b><br /><br />';
    		}
    		
    		return ( $kategorie );
    }
    
    
    
    if ( !is_numeric($menu->get(1)) )  {
      if($menu->get(1) == 'rss' || $menu->get(1) == 'atom')
      {
          #ob_clean();
          $feed_type = $menu->get(1);
          
        $abf = "SELECT MAX(news_time) AS last_update FROM prefix_giganews";
        $erg = db_query($abf);
        $row = db_fetch_assoc($erg);
        $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
        
        $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
        $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,"; 
        $abf .=  
         "a.news_kat as kate,
          a.news_text as text,
          b.name as username
        FROM prefix_giganews as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE a.news_recht = 0
        ORDER BY news_time ASC LIMIT 15";
        $erg = db_query($abf);
        $tpl = new tpl( 'news_'.$menu->get(1).'.htm' );
        
        header('Content-type: application/' . $menu->get(1)  . '+xml');
    
        $tpl->set_ar_out(array('FEEDTITLE' => $allgAr['title'],
                               'UPDATED' => $last_update), 0);
        while ($row = db_fetch_assoc($erg))
        {
          if($feed_type == 'atom')
          {
              $row['datum'] = str_replace(' ', 'T', $row['datum']) . 'Z';
          }
          
          $a = explode('[PREVIEWENDE]', $row['text']);
          $tpl->set_ar_out(array('TITLE' => $row['title'],
                                 'TXT' => bbcode($a[0]),
                                 'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']). '/index.php?giganews-' . $row['id'],
                                 'AUTHOR' => $row['username'],
                                 'DATE' => $row['datum']
                                 ), 1);
        }
        $tpl->out(2);
        exit;
      }
      else
      {
        $design->header();
        $limit = $allgAr['Nlimit'];
        $page = ( $menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
        $MPL = db_make_sites ($page , "WHERE news_recht >= ".$_SESSION['authright'] , $limit , '?giganews' , 'giganews' );
        $anfang = ($page - 1) * $limit;
        
        $tpl = new tpl ( 'giganews.htm' );
        
        $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username
        FROM prefix_giganews as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE ".$_SESSION['authright']." <= a.news_recht
           OR a.news_recht = 0
        ORDER BY news_time DESC 
        LIMIT ".$anfang.",".$limit;
        #echo '<pre>'.$abf.'</pre>';
    
        ?>
    	<table border="0">
      	<tr>
        	    <td><img src="include/images/sonstiges/giga.gif"><br><br><br></td>
     	</tr>
    	</table>
       <?php
    
        $erg = db_query($abf);
        while ($row = db_fetch_assoc($erg)) {
          
          $k0m  = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'");
          $row['kom']  = db_result($k0m,0);
          
          $row['kate'] = news_find_kat($row['kate']);
          $row['datum'] = $lang[$row['dayofweek']].' '.$row['datum'];
          if ( strpos ( $row['text'] , '[PREVIEWENDE]' ) !== FALSE ) {
            $a = explode('[PREVIEWENDE]' , $row['text']);
            $row['text'] = $a[0];
          }
          $row['text'] = bbcode($row['text']);
          $tpl->set_ar_out($row,0);
        }
        $tpl->set_out('SITELINK', $MPL,1);
        unset($tpl);
      }
    
      
      
    } else {
     
     $design->header();
     $nid = escape($menu->get(1), 'integer');
     $row = db_fetch_object(db_query("SELECT * FROM `prefix_giganews` WHERE news_id = '".$nid."'"));
    
      if ( has_right(array($row->news_recht)) ) {
        $komsOK = true;
    	  if ( $allgAr['Ngkoms'] == 0 ) {
          if ( loggedin() ) {
            $komsOK = true;
      		} else {
    	  	  $komsOK = false;
    		  }
        }
    	  if ( $allgAr['Nukoms'] == 0 ) {
    	    $komsOK = false;
    	  }
    
        # kommentar add
      	if ( $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt']) ) {
          $_POST['txt'] = escape($_POST['txt'],'string');
    		  $_POST['name'] = escape($_POST['name'],'string');
          db_query("INSERT INTO `prefix_koms` VALUES ('',".$nid.",'NEWS','".$_POST['name']."','".$_POST['txt']."')");
    	  } 
    	  # kommentar add
    		
        # kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(-7, 'news')) {
          $kommentar_id = escape($menu->getE(2),'integer');
          db_query("DELETE FROM prefix_koms WHERE uid = ".$nid." AND cat = 'NEWS' AND id = ".$kommentar_id);
        }
        # kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
    		
    		$textToShow = bbcode($row->news_text);
    		$textToShow = str_replace('[PREVIEWENDE]','',$textToShow);
    		if ( !empty($such) ) {
    		  $textToShow = markword($textToShow,$such);
    		}
    		
    		$tpl = new tpl ( 'giganews.htm' );
    		$ar = array (
          'TEXT'  => $textToShow,
    			'KATE'  => $kategorie,
          'NID' => $nid,
          'uname' => $_SESSION['authname'],
    			'NAME'  => $row->news_title
    		);
    		$tpl->set_ar_out($ar, 2 );
    		
    		if ($komsOK) {
    		  $tpl->set_ar_out ( array ( 'NAME' => $row->news_title , 'NID' => $nid ), 3 );
    		}
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = ".$nid." AND cat = 'NEWS' ORDER BY id DESC");
    		$ergAnz1 = db_num_rows($erg1);
    		if ( $ergAnz1 == 0 ) {
    		  echo '<b>'.$lang['nocomments'].'</b>';
    		} else {
    		  $zahl = $ergAnz1;
    		  while ($row1 = db_fetch_assoc($erg1)) {
            $row1['text'] = bbcode(trim($row1['text']));
            if (has_right(-7, 'news')) {
              $row1['text'] .= '<a href="?giganews-'.$nid.'-d'.$row1['id'].'"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
            }
            $tpl->set_ar_out( array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl ) , 4 );
            $zahl--;
    		  }
        }
    	}
      $tpl->out(5);
    }
    
    $design->footer();
    
    ?>


    Und hier der Quellcode der giganews.htm seite (Templates Ordner):

    <div style="float:left; width:80%; padding-top:0px; ">
    
    <table border="0" height="10%" width="440" cellspacing="0" cellpadding="0" align="left">      	
    <tr>
    <td  background="include/images/sonstiges/hintergrund.gif" height="78" valign="top">
    
    
      <table style="padding-top:0px;" border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="15%" rowspan="2">{kate}</td>
          <td width="85%"><a href="index.php?giganews-{id}"><font size="2"><b>{title}</b></a></td>
        </tr>
        <tr>
          <td width="85%"><font face="Arial" size="2">{text}</font></td>
        </tr>
      </table>
    
    </td>
    </tr>
    </table>
    </div>
    <style="clear:both; " />
    
    {EXPLODE}
    
      
    {EXPLODE}
    <!-- giganews Kommentare und Mehr lesen -->
    <table class="border" width="100%" cellpadding="5" cellspacing="1" border="0">
      <tr class="Chead"> 
        <th height="25"><b>{NAME}</b></th>
      </tr>
      <tr> 
        <td height="25" class="Cdark">{_lang_message}</td>
      </tr>
      <tr> 
        <td class="Cnorm">
          <div style="float:left; ">{KATE}</div>
    	    <div style="float:left; padding-left:10px; ">{TEXT}</div><br style="clear:both; " />
          <p></p>
          <a href="index.php?giganews"><b>&laquo;</b> {_lang_back}</a> </td>
      </tr>
    	
      <tr> 
        <td height="25" class="Cmite">{_lang_commentsfor} {NAME}</td>
      </tr>
      <tr>
        <td class="Cnorm">
        
    	    {EXPLODE}
    	    <form action="index.php?giganews-{NID}" method="POST">
            <fieldset>
              <legend>{_lang_writecomment}</legend>
              <input type="text" name="name" value="{uname}" /> &nbsp; &nbsp; <input type="submit" value="{_lang_enter}"><br />
              <textarea cols="50" rows="2" name="txt"></textarea><br />
            </fieldset>
          </form>
          <br />
          {EXPLODE}
          
          <span class="Cmite"># <b>{ZAHL}</b> von {NAME}</span>
          <br />{TEXT}<br /><br />
          
          {EXPLODE}
          <br />
          <a href="index.php?giganews"><b>&laquo;</b> {_lang_back}</a>
          
        </td>
      </tr>
    </table>
    
    {EXPLODE}
    
    <table width="100%" border="0" cellspacing="0" cellpadding="5" class="rand">
      <tr class="mite"> 
        <td width="65%"><b>{NAME}</b></td>
        <td width="15%">{FUER}</td>
        <td width="20%" align="right">{DATE}</td>
      </tr><tr class="norm"> 
        <td valign="top" colspan="2">{TEXT}{MEHR}</td>
        <td valign="top" rowspan="2" align="center">{KATE}</td>
      </tr><tr class="norm"> 
        <td valign="bottom" height="20" colspan="2" align="center"> 
          <b>{_lang_from} {UNAME}</b> &nbsp; &nbsp; &nbsp; [ {KOM} <a href="index.php?giganews-1&amp;nid={ID}">{_lang_comments}</a> ] 
        </td>
      </tr>
    </table>


    betroffene Homepage: externer Link


    Zuletzt modifiziert von Alienuser am 08.06.2006 - 09:31:31
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu HTML, PHP, SQL,...

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten