Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [wolontariat][php5]Problemik newsikami
Forum PHP.pl > Inne > Giełda ofert > Poszukuję
Konuss
  1. <?php
  2. /**
  3. * Wyswietlenie listy newsow itp.
  4. *
  5. * @author  m@sote.pl
  6. * @version $: newsedit.inc.php,v 1.2 2008-01-14 ::41 michal Exp $
  7. *
  8. * @verified 2004-03-22 m@sote.pl
  9. * @package    newsedit
  10. */
  11.  
  12. /**
  13. * Lista newsów
  14. */
  15. class NewsEdit {
  16.    
  17.    /**
  18.     * Wy&para;wietl liste newsów wg grupy
  19.     *
  20.     * @param int $group ID grupy newsow (id z tabeli newsedit_groups)
  21.     * @global $_REQUEST['group'] int ID grupy newsów (z tabeli newsedit_groups)
  22.     *
  23.     * @return none
  24.     */
  25.    function show_list($group=1) {
  26.        global $config,$_REQUEST;
  27.        
  28.        if (@$_REQUEST['group']) {$group = @$_REQUEST['group'];} else {$group = 1;}
  29.        
  30.        $and_group="id_newsedit_groups=1";
  31.        if (! empty($group)) {
  32.            $group=intval($group);
  33.            $and_group="id_newsedit_groups=$group";
  34.        } elseif (! empty($_REQUEST['group'])) {
  35.            if (ereg("^[0-9]+$",$_REQUEST['group'])) {
  36.                $group=intval($_REQUEST['group']);
  37.                $and_group="id_newsedit_groups=$group";
  38.            } else return false;
  39.        }
  40.        
  41.        $group=addslashes($group);
  42.        
  43.        // lista newsow
  44.        $sql="SELECT * FROM newsedit WHERE lang='".$config->lang."' AND active=1 AND
  45.                        ($and_group OR group1=$group OR group2=$group OR group3=$group) AND `date_add` <= NOW()
  46.                ORDER BY ordercol DESC";                
  47.                
  48.        
  49.        $dbedit =& new DBEdit;
  50.        $dbedit->dbtype=$config->dbtype;
  51.        $dbedit->top_links="false";
  52.        $dbedit->record_class="NewsEditRow";
  53.        $dbedit->empty_list_message="";
  54.        
  55.        if (ereg("^[0-9]+$",$group)) {
  56.            global $__group;
  57.            $__group=$group;            
  58.            require_once ("plugins/_newsedit/include/newsedit_row.inc.php");
  59.        }
  60.        
  61.        // print $sql;
  62.        
  63.        $dbedit->record_list($sql);
  64.        
  65.        return;
  66.    } // end show_list()
  67.  
  68.    
  69.    /**
  70.     * Ile jest newsów
  71.     *
  72.     * @param int $group ID grupy newsow (id z tabeli newsedit_groups)
  73.     * @global $_REQUEST['group'] int ID grupy newsów (z tabeli newsedit_groups)
  74.     * @author lech@sote.pl
  75.     *
  76.     * @return int liczba newsów
  77.     */
  78.    function get_news_count($group = 1) {
  79.        global $config,$_REQUEST, $mdbd;
  80.                
  81.        $and_group="id_newsedit_groups=1";
  82.        if (! empty($group)) {
  83.            $group=intval($group);
  84.            $and_group="id_newsedit_groups=$group";
  85.        } elseif (! empty($_REQUEST['group'])) {
  86.            if (ereg("^[0-9]+$",$_REQUEST['group'])) {
  87.                $group=intval($_REQUEST['group']);
  88.                $and_group="id_newsedit_groups=$group";
  89.            } else return false;
  90.        }
  91.        
  92.        $group=addslashes($group);
  93.        
  94.        $where="lang='".$config->lang."' AND active=1 AND
  95.                        ($and_group OR group1=$group OR group2=$group OR group3=$group) ";
  96.        
  97.        $mdbd->select('id', 'newsedit', $where, array());
  98.        return $mdbd->num_rows;
  99.    } // end get_news_count()
  100.    
  101. } // end class NewsEdit
  102.  
  103. $newsedit =& new NewsEdit;
  104.  
  105.  
  106. ?>


Mam taki kodzik czy któryś z kolegów pomógłby mi go tak zmodyfikować aby wyświetlał jeden news + 5 samych tematów dalszych newsów np. Serdecznie dziękuje za pomoc.
Cysiaczek
Giełda ofert -> Poszukuję [wolontariat]
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.