Новости как на megashara

werkraft

Создатель
Регистрация
11 Мар 2010
Сообщения
32
Реакции
1
Здравствуйте, помогите сделать вывад навостей как на мегашаре. зарание спасибо!
 
Хотя бы написали что за движок, под какую CMS вам надо сделать копию, а то тут не ясновидящие сидят, если же вам с нуля такое надо то это не имеет смысла, ставить готовую CMS надо, там вроде WordPress стоит на мегашаре
 
Последнее редактирование:
Под DLE. Там вывод Контента по категориям на главной! Вот мне это нужно.Спасибо!
 
Или даже под torrentpeir
 
Для просмотра ссылки Войди или Зарегистрируйся Я это хочу реализовать но у меня не чего не получается Вот код
PHP:
<?php
// +------------------------------------------------------------------------+
// | PHP Melody ( www.phpsugar.com )
// +------------------------------------------------------------------------+
// | PHP Melody IS NOT FREE SOFTWARE
// | If you have downloaded this software from a website other
// | than www.phpsugar.com or if you have received
// | this software from someone who is not a representative of
// | PHPSUGAR, you are involved in an illegal activity.
// | ---
// | In such case, please contact: support@phpsugar.com.
// +------------------------------------------------------------------------+
// | Developed by: PHPSUGAR (www.phpsugar.com) / support@phpsugar.com
// | Copyright: (c) 2004-2013 PHPSUGAR. All rights reserved.
// +------------------------------------------------------------------------+

session_start();
require('config.php');
require_once('include/functions.php');
require_once('include/user_functions.php');
require_once('include/islogged.php');
require_once('include/rating_functions.php');
$modframework->trigger_hook('category_top');
   
    $resync = 0;
        $i = 0;
    $category = array();
    $total_items = 0;
    $videos = $cats = array();
        $children = array();
        $parentid = $parent_ids = array();
    $categories = load_categories(array('db_table' => 'pm_categories'));

    foreach ($categories as $c)
    {
        if ($c['parent_id'] == 0)
        {
            $parents[] = $c;
            $parent_ids[] = $c['id'];
        }
        else
        {
            $children[$c['parent_id']][] = $c;
        }
               
                //$test = $parent_ids[$c['id']] ;
    }       
 
    foreach ($parents as $c_id => $c)
    {
            $cats[$i] = $c;   
           
                //if ($c['parent_id'] == 0)
        //{                 
                    //$smarty->assign('gv_category_name', $c['name']);
                   
                    //$parentid[$c_id] = $c['parent_id'];
                    $cats[$i]['gv_category_name'] = $c['name'];
                    $cats[$i]['gv_category_name_id'] = $children;
       
                   

               
        //'.implode(",", $Query).'

    $sql = 'SELECT * FROM pm_videos WHERE category IN(1,2,4,5,6,7,8,9,10,11) ORDER BY added DESC ';//WHERE category IN(1,2,4,5,6,7,8,9,10,11)
   
    $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result))
    {
        $videos[$i] = $row;
           
        $sql_date = date('Y-m-d', $row['added']);
        $date_diff = round( abs(strtotime(date('Y-m-d'))-strtotime($sql_date)) / 86400, 0 );
       
        $videos[$i]['attr_alt'] = htmlspecialchars(stripslashes($row['video_title']));
        $videos[$i]['excerpt'] = generate_excerpt($row['description'], 255);

        if ($date_diff < _ISNEW_DAYS)
        {
            $videos[$i]['mark_new'] = true;
        }
       
        if ($row['site_views'] > _ISPOPULAR)
        {
            $videos[$i]['mark_popular'] = true;
        }

        if (function_exists('bin_rating_get_item_meta'))
        {
            $rating_meta = bin_rating_get_item_meta($row['uniq_id']);
            $balance = bin_rating_calc_balance($rating_meta['up_vote_count'], $rating_meta['down_vote_count']);

            $videos[$i]['up_vote_count'] = (int) $rating_meta['up_vote_count'];
            $videos[$i]['likes'] = $videos[$i]['up_vote_count'];
            $videos[$i]['down_vote_count'] = (int) $rating_meta['down_vote_count'];
            $videos[$i]['dislikes'] = $videos[$i]['down_vote_count'];
           
            $videos[$i]['up_vote_count_formatted'] = pm_number_format($videos[$i]['up_vote_count']);
            $videos[$i]['down_vote_count_formatted'] = pm_number_format($videos[$i]['down_vote_count']);
            $videos[$i]['up_vote_count_compact'] = pm_compact_number_format($videos[$i]['up_vote_count']);
            $videos[$i]['down_vote_count_compact'] = pm_compact_number_format($videos[$i]['down_vote_count']);
           
            $videos[$i]['likes_formatted'] = $videos[$i]['up_vote_count_formatted'];
            $videos[$i]['dislikes_formatted'] = $videos[$i]['down_vote_count_formatted'];
            $videos[$i]['likes_compact'] = $videos[$i]['up_vote_count_compact'];
            $videos[$i]['dislikes_compact'] = $videos[$i]['down_vote_count_compact'];
           
            $videos[$i] = array_merge($videos[$i], $balance);
        }
       
        $author_data = fetch_user_info($row['submitted']);

        $videos[$i]['duration'] = sec2hms($row['yt_length']);
        $videos[$i]['video_href'] = makevideolink($row['uniq_id'], $row['video_title'], $row['category']);
        $videos[$i]['thumb_img_url'] = show_thumb($row['uniq_id'], 1, $row);
        $videos[$i]['author_username'] = $row['submitted'];
                $videos[$i]['CAT_NAME'] = $category['title'][$row['category']];
        $videos[$i]['author_user_id'] = $author_data['id'];
        $videos[$i]['author_power'] = $author_data['power'];
        $videos[$i]['author_name'] = $author_data['name'];
        $videos[$i]['author_avatar_url'] = $author_data['avatar_url'];
        $videos[$i]['author_profile_href'] = ($row['submitted'] != 'bot') ? _URL .'/profile.'. _FEXT .'?u='. $row['submitted'] : '#';
       
        $videos[$i]['html5_datetime'] = date('Y-m-d\TH:i:sO', $row['added']); // ISO 8601
        $videos[$i]['full_datetime'] = date('l, F j, Y g:i A', $row['added']);
        $videos[$i]['time_since_added'] = time_since($row['added']);
        $videos[$i]['views_compact'] = pm_compact_number_format($row['site_views']);

        //$videos[$i]['comments'] = 0; // EDITME @todo
        //$videos[$i]['comments_compact'] = pm_compact_number_format(0); // EDITME @todo
        $i++;
    }
        mysql_free_result($result); }
    //}           
       
//$smarty->assign('cat_id', $cats);
$smarty->assign('problem', $problem);
//$smarty->assign('gv_category_name', $category_name);
//$smarty->assign('gv_cat', $cat_name);
$smarty->assign('gv_pagenumber', $page);
$smarty->assign('gv_sortby', $sortby);
//$smarty->assign('gv_category_description', $category['description']);

$smarty->assign('page_count_info', $page_count_info);
$smarty->assign('pag_left', $pag_left);
$smarty->assign('pag_right', $pag_right);

$smarty->assign('resultscats', $cats);
$smarty->assign('results', $videos);
// --- DEFAULT SYSTEM FILES - DO NOT REMOVE --- //
$smarty->assign('template_dir', $template_f);
$smarty->display('video-category-all.tpl');
?>
 
Я вообще не понял, что вы мудрите
Ставите DLE и настраиваете вывод новостей в шаблоне - как, где и куда угодно
Читайте документацию dle про тег {custom}
Для просмотра ссылки Войди или Зарегистрируйся
 
Все я вывод по категориям сделал. Вот код но теперь не могу сделать чтоб все новости подкатегорий тоже выводились. Вот код
PHP:
session_start();
require('config.php');
require_once('include/functions.php');
require_once('include/user_functions.php');
require_once('include/islogged.php');
require_once('include/rating_functions.php');
$modframework->trigger_hook('category_top');
  
   $resync = 0;
  $i = 0;
   $category = array();
   $total_items = 0;
   $videos = $cats = array();
  $parents = $parent_ids = $children = array();
   $categories = load_categories(array('db_table' => 'pm_categories'));

   foreach ($categories as $c_id => $c)
   {
     if ($c['parent_id'] == 0)
     {
       $parents[] = $c;
       $parent_ids[] = $c['id'];
     }
     else
     {
       $children[$c['parent_id']][] = $c;
     }
   }
  
  
  
   foreach ($parents as $k => $p)
   {
  $cats[$i] = $p;
  
  $cats[$i]['gv_category_name'] = $p['name'];
  
  
  foreach ($children[$p['id']] as $c_id => $child)
  {

  $pod_cats = implode(",", $child['id']);//implode(",", $c_id);//implode(",", $children[$c['id']]);

  }  

  $sql = 'SELECT * FROM pm_videos WHERE category IN('.$pod_cats.') ORDER BY added DESC ';//WHERE category IN(1,2,4,5,6,7,8,9,10,11)

  $result = mysql_query($sql);
  while ($row = mysql_fetch_assoc($result))
  {
  $videos[$i] = $row;

  $sql_date = date('Y-m-d', $row['added']);
  $date_diff = round( abs(strtotime(date('Y-m-d'))-strtotime($sql_date)) / 86400, 0 );

  $videos[$i]['attr_alt'] = htmlspecialchars(stripslashes($row['video_title']));
  $videos[$i]['excerpt'] = generate_excerpt($row['description'], 255);

  if ($date_diff < _ISNEW_DAYS)
  {
  $videos[$i]['mark_new'] = true;
  }

  if ($row['site_views'] > _ISPOPULAR)
  {
  $videos[$i]['mark_popular'] = true;
  }

  if (function_exists('bin_rating_get_item_meta'))
  {
  $rating_meta = bin_rating_get_item_meta($row['uniq_id']);
  $balance = bin_rating_calc_balance($rating_meta['up_vote_count'], $rating_meta['down_vote_count']);

  $videos[$i]['up_vote_count'] = (int) $rating_meta['up_vote_count'];
  $videos[$i]['likes'] = $videos[$i]['up_vote_count'];
  $videos[$i]['down_vote_count'] = (int) $rating_meta['down_vote_count'];
  $videos[$i]['dislikes'] = $videos[$i]['down_vote_count'];

  $videos[$i]['up_vote_count_formatted'] = pm_number_format($videos[$i]['up_vote_count']);
  $videos[$i]['down_vote_count_formatted'] = pm_number_format($videos[$i]['down_vote_count']);
  $videos[$i]['up_vote_count_compact'] = pm_compact_number_format($videos[$i]['up_vote_count']);
  $videos[$i]['down_vote_count_compact'] = pm_compact_number_format($videos[$i]['down_vote_count']);

  $videos[$i]['likes_formatted'] = $videos[$i]['up_vote_count_formatted'];
  $videos[$i]['dislikes_formatted'] = $videos[$i]['down_vote_count_formatted'];
  $videos[$i]['likes_compact'] = $videos[$i]['up_vote_count_compact'];
  $videos[$i]['dislikes_compact'] = $videos[$i]['down_vote_count_compact'];

  $videos[$i] = array_merge($videos[$i], $balance);
  }

  $author_data = fetch_user_info($row['submitted']);

  $videos[$i]['duration'] = sec2hms($row['yt_length']);
  $videos[$i]['video_href'] = makevideolink($row['uniq_id'], $row['video_title'], $row['category']);
  $videos[$i]['thumb_img_url'] = show_thumb($row['uniq_id'], 1, $row);
  $videos[$i]['author_username'] = $row['submitted'];
  $videos[$i]['author_user_id'] = $author_data['id'];
  $videos[$i]['author_power'] = $author_data['power'];
  $videos[$i]['author_name'] = $author_data['name'];
  $videos[$i]['author_avatar_url'] = $author_data['avatar_url'];
  $videos[$i]['author_profile_href'] = ($row['submitted'] != 'bot') ? _URL .'/profile.'. _FEXT .'?u='. $row['submitted'] : '#';

  $videos[$i]['html5_datetime'] = date('Y-m-d\TH:i:sO', $row['added']); // ISO 8601
  $videos[$i]['full_datetime'] = date('l, F j, Y g:i A', $row['added']);
  $videos[$i]['time_since_added'] = time_since($row['added']);
  $videos[$i]['views_compact'] = pm_compact_number_format($row['site_views']);

  //$videos[$i]['comments'] = 0; // EDITME @todo
  //$videos[$i]['comments_compact'] = pm_compact_number_format(0); // EDITME @todo
  $i++;
  }
  mysql_free_result($result);
  
  }  
//$smarty->assign('cat_id', $cats);
$smarty->assign('problem', $problem);
//$smarty->assign('gv_category_name', $category_name);
//$smarty->assign('gv_cat', $cat_name);
$smarty->assign('gv_pagenumber', $page);
$smarty->assign('gv_sortby', $sortby);
//$smarty->assign('gv_category_description', $category['description']);

$smarty->assign('page_count_info', $page_count_info);
$smarty->assign('pag_left', $pag_left);
$smarty->assign('pag_right', $pag_right);

$smarty->assign('resultscats', $cats);
$smarty->assign('results', $videos);
// --- DEFAULT SYSTEM FILES - DO NOT REMOVE --- //
$smarty->assign('template_dir', $template_f);
$smarty->display('video-category-all.tpl');
 
Назад
Сверху