Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 5 Ответов
  • 7764 Просмотров
*

DSergeev™

  • Захожу иногда
  • 64
  • 1 / 0
  • Не возжелай себе рейтинга другого блоггера
Возникла проблемка как организовать отображение вместо даты только время публикации статьи, не кто не сталкивался?

дату этот гад извлекает вот так:

Код

$nullDate = $db->getNullDate();

$date =& JFactory::getDate();
$now = $date->toMySQL();


други выручайте!
*

DSergeev™

  • Захожу иногда
  • 64
  • 1 / 0
  • Не возжелай себе рейтинга другого блоггера
дык формат даты то указать можно, а вот формат времени нет :(
*

effrit

  • Легенда
  • 10132
  • 1118 / 13
  • effrit.com
в районе 343 строки замени
$format_date = $params->get('format_date', JText::_('DATE_FORMAT_LC1'));
на нужный формат. к примеру
$format_date = $params->get('format_date', JText::_("%Y-%m-%d-%H:%M:%S"));

а в настройках модуля очисти поле с форматом даты
*

DSergeev™

  • Захожу иногда
  • 64
  • 1 / 0
  • Не возжелай себе рейтинга другого блоггера
Спасибки, я был уже практически рядом, как раз сидел щас код helper.php перечитывал, дошел до 150 строки и тут решил сюда заглянуть...

еще раз спасибо, проверил работает + в репутацию запостил ;)

Для тех у кого еще возникнет такая проблема измененный код файла helper.php

Код
<?php
###################################################################################################
#  Display News  1.6.5 - Oct -2009 by bkomraz1@gmail.com
#  http://joomla.rjews.net
#  Based on Display News - Latest 1-3 [07 June 2004] by Rey Gigataras [stingrey]   www.stingrey.biz  mambo@stingrey.biz
#  @ Released under GNU/GPL License : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
###################################################################################################


defined ( '_JEXEC' ) or die ( 'Restricted access' );

// loads module function file
require_once (JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php');
require_once (JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table' . DS . 'category.php');
require_once (JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table' . DS . 'section.php');
require_once (JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table' . DS . 'content.php');

class modDisplayNewsHelper {

        var $css_type = null;
        var $version = "Display News by BK 1.6.6";

   // Function to filter HTML code and special characters from text
   function dn_filter( $text ) {
      $text = strip_tags($text, /* exclude */ "<img>");
//      $text = preg_replace("'<script[^>]*>.*?</script>'si","",$text);
      $text = preg_replace("@<script[^>]*?>.*?</script>@si","",$text);
      $text = preg_replace('/{.+?}/','',$text);
      $text = preg_replace('/(( )|(&nbsp;))+/',' ',$text);
      // $text = preg_replace('/&amp;/',' ',$text);
      $text = preg_replace('/&quot;/',' ',$text);
      // $text = htmlspecialchars($text);
      return $text;
   }

   //  Function required to create set of Names, '' added
   function dn_set_name( $param ) {
          if ($param <> "") {
         $paramA = explode(",", $param);
         $a = "0";
         foreach ($paramA as $paramB) {
            $paramB = trim($paramB);
            $paramB = "'".addslashes($paramB)."'";
            $paramA[$a] = $paramB;
            $a++;
         }
         $param= implode(",", $paramA);
      }
          return $param;
   }
   //---------------------------------------------------------------------
   //  Functinality to allow text_hover to be blank by use if special character "#" entered
   //  If not then space added to the end of the variables
   function dn_hovertext( &$text ) {
      if ($text == "#") {
         $text = "";
      } else {
         $text .= " ";
      }
   }
   //---------------------------------------------------------------------


   // Function that limits title, intro or full to specified character or word length
        function dn_limit( &$text, $limit_type, $length_chars, $href ) {

                if ( $limit_type < 2 || !$length_chars ) {
                        return 0;
                }

                $titletext = "";
                $visiblelen = 0;
                $triger = 0;
                for($i=0;$i<strlen($text);$i++)
                {
                    $char=substr($text,$i,1);

                        if ($char == "<" || $char == ">") {
                                $triger ++;
                        }

                        if ( !$triger && ( ($limit_type == 2) || ($char == " ")) ) {
                                $visiblelen ++;
                        }

                        if ($visiblelen > $length_chars) {
                                break;
                        }

                        // UTF Lenght. should be added to string "as is"
                        // 0xC0-0xFD
                        if ((ord($char)>= 192) && (ord($char)<=253) ) {
                                $titletext = $titletext . $char;
                                for ($j=$i+1;$j<strlen($text);$j++) {
                                        $char=substr($text,$j,1);
                                        if ((ord($char)>= 128) && (ord($char)<=191) ) {
                                                $titletext = $titletext . $char;
                                                $i=$j;
                                        }
                                        else {
                                                break;
                                        }
                                }
                        } else {
                                $titletext = $titletext . $char;
                        }


                        if ($triger == 2) {
                                $triger = 0;
                        }


                }

                if ($visiblelen > $length_chars) {
                        $titletext = chop($titletext);
                        $titletext .= strlen($href)? '<a href="'.$href.'">...</a>' : '...';
                        $title = $titletext;
                        $text = $title;
                        return 1;
                } else {
                        $title = $titletext;
                        $text = $title;
                        return 0;
                }

   }
   /**---------------------------------------------------------------------**/
   /*
   //  Functinality to convert Set Name to Set Id to be used by show_more
   function dn_name_id( $id, $name ) {
      global $database;
      if ( strchr($name, ",") ) {
         $id = "";
      } else {
         $database->setQuery("SELECT a.id"
         ."\n  FROM #__sections AS a"
         ."\n  WHERE a.title = '$name'");
         $id = $database->loadResult();
      }
      return $id;
   }
   */
   //---------------------------------------------------------------------
   //---------------------------------------------------------------------

        function dn_style_convert( $id ) {

                if ( ! $this->css_type )
                        return $id;

                $convert = array(
                        "dn-title"                              => array("content" => "contentpagetitle",                                       "table" => "",                  "latestnews" => ""),
                        // "dn-title_auto"              => array("content" => "contentpagetitle",       "table" => "sectiontableheader", "latestnews" => ""),
                        /**/"dn-whole"                          => array("content" => "",       "table" => "contentpane",            "latestnews" => ""),
                        /**/"dn-module_title"   => array("content" => "",      "table" => "sectiontableheader", "latestnews" => ""),
                        "dn-module_description" => array("content" => "contentdescription", "table" => "contentdescription", "latestnews" => ""),
                        "dn-each"               => array("content" => "contentpaneopen",                                        "table" => "sectiontableentry",  "latestnews" => ""),
                        /**/"dn-section"        => array("content" => "",      "table" => "",                    "latestnews" => ""),
                        /**/"dn-category"                       => array("content" => "",                                       "table" => "",                   "latestnews" => ""),
                        /**/"dn-date"                           => array("content" => "createdate",     "table" => "createdate", "latestnews" => "createdate"),
                        /**/"dn-author"                         => array("content" => "small",                          "table" => "",                   "latestnews" => "small"),
                        /**/"dn-head"                           => array("content" => "contentheading",         "table" => "",                   "latestnews" => "latestnews"),
                        "dn-hits"                               => array("content" => "",                                       "table" => "",                   "latestnews" => ""),
                        "dn-introtext"                  => array("content" => "",       "table" => "",                   "latestnews" => ""),
                        "dn-introtext-link"     => array("content" => "",      "table" => "",                    "latestnews" => ""),
                        "dn-fulltext"                   => array("content" => "",       "table" => "",                   "latestnews" => ""),
                        "dn-read_more"                  => array("content" => "readon",                         "table" => "readon",             "latestnews" => "readon"),
                        "dn"                                    => array("content" => "",                                       "table" => "",                   "latestnews" => "latestnews"),
                        "dn"                                    => array("content" => "",                                       "table" => "",                   "latestnews" => "latestnews"),
                        "arrow-dn"                              => array("content" => "",                                       "table" => "",                   "latestnews" => "latestnews"),
                        "list-dn"                               => array("content" => "",                                       "table" => "",                   "latestnews" => "latestnews"),
                        "dn-more"                               => array("content" => "",                                       "table" => "",                   "latestnews" => ""),
                        "dn-module_link"                => array("content" => "",                                       "table" => "",                   "latestnews" => "")
                );

                $result = $convert[$id][$this->css_type];
                return $result ? $result : "";

        }

        function dn_style( $id, $extra_style='',  $k = "" ) {
                $dnstyle=modDisplayNewsHelper::dn_style_convert($id)."${k}" ;
                return "class='${dnstyle}".$this->moduleclass_sfx." ".$extra_style."'";
        }

function imageResize($originalImage,$toWidth,$toHeight){

    // Get the original geometry and calculate scales
    $size = getimagesize($originalImage);
    if ( !$size || !$toWidth || !$toHeight ) {
        return;
    }
    list($width, $height) = $size;

        if ( $width <= $toWidth && $height <= $toHeight) {
                return " width=\"$width\" height=\"$height\" ";
        }

    $xscale=$width/$toWidth;
    $yscale=$height/$toHeight;

    // Recalculate new size with default ratio
    if ($yscale>$xscale){
        $new_width = round($width * (1/$yscale));
        $new_height = round($height * (1/$yscale));
    }
    else {
        $new_width = round($width * (1/$xscale));
        $new_height = round($height * (1/$xscale));
    }

        return " width=\"$new_width\" height=\"$new_height\" ";
}

function main(&$params)
{


global $mosConfig_lang, $mosConfig_mbf_content, $mainframe;


// $globalConfig = &JComponentHelper::getParams( 'com_content' );
// $globalConfig = &$mainframe->getParams('com_content');

static $globalConfig;
if (!isset($globalConfig) ) {
        $com_content = &JComponentHelper::getComponent( 'com_content' );
        $globalConfig = new JParameter($com_content->params);
}


//----- Parameters - Criteria ( 19 ) ------------------------------------------
$set_count = $params->get('set_count' ) ;
if ( !$set_count ) {
        $set_count = 1000000000;
}

$show_tooltips                  = $params->get( 'show_tooltips', 0 );
$set_date_today                 = $params->get( 'set_date_today', 0 );
// 5-10      5 - older than 5 days, newly than 10 days
// 5 newly than 5 days old
$set_date_range                 = $params->get( 'set_date_range', 0 );

$publish_up_spec = "";
if ( substr($set_date_range, 0, 1) == "p" ) {
                $set_date_newly = 0;
                $set_date_older = 0;
                $publish_up_spec = "p";
} else {
        $tokens = split("-", $set_date_range,2);
        if (count($tokens)==2) {
                $set_date_older = $tokens[0];
                $set_date_newly = $tokens[1];
        } else if ( count($tokens)==1 ) {
                $set_date_newly = $tokens[0];
                $set_date_older = 0;
        }
}

$set_date_month                 = $params->get( 'set_date_month', "" );
$set_date_year                  = $params->get( 'set_date_year', "");

$set_auto                       = $params->get( 'set_auto', 0 );
$set_auto_author                = $params->get( 'set_auto_author', 0);

// FIXME show_frontpage -> num value
$show_frontpage                 = $params->get( 'show_frontpage', "y" );

$set_category_id_extra       = $params->get( 'set_category_id_extra', 0);
$set_category_id                = $params->get( 'set_category_id', 0);

$set_section_id_extra        = $params->get( 'set_section_id_extra', 0);
$set_section_id                 = $params->get( 'set_section_id', 0);

$set_article_id                 = $params->get( 'set_article_id', 0);

$set_author_id                  = $params->get( 'set_author_id', "");
$set_author_name                = $params->get( 'set_author_name', "");

$minus_leading                  = $params->get( 'minus_leading', 0 );
$hide_current                   = $params->get( 'hide_current', 0 );
//---------------------------------------------------------------------

//----- Parameters - Display ( 19 ) ------------------------------------------
$this->css_type = $params->get('css_type', "content" );
if ( $this->css_type == "dedicated" ) {
        $this->css_type = "";
}
$show_image = $params->get('image', 0);
$image_align = $params->get('image_align', 0);
// $image_valign = $params->get('image_valign', 0);
$image_margin = $params->get('image_margin', "");
$image_size = $params->get('image_size', "");
$image_scale = $params->get('image_scale', 1);
$image_width = $image_height = 150;
if ($image_size <> "") {
        $image_sizes = explode("x", $image_size);
        if ( isset($image_sizes[0]) && $image_sizes[0] > 0 ) {
                $image_width = $image_sizes[0];
        }
        if ( isset($image_sizes[1]) && $image_sizes[1] > 0 ) {
                $image_height = $image_sizes[1];
        } else {
                $image_height = $image_width;
        }
}
$image_scale = $params->get('image_scale', 1);
$image_num = $params->get('image_num', 0);
$link_image = $params->get('link_image', 0);

$show_title_auto = $params->get('show_title_auto' , 0 );
$use_modify_date = $params->get('use_modify_date', 0);
switch ($use_modify_date) {
        case 1:  $created = "modified"     ; break ;;
        case 2:  $created = "publish_up"   ; break ;;
        case 3:  $created = "publish_down" ; break ;;
        default: $created = "created"      ; break ;;
}
// $created = $use_modify_date ? "modified" : "created";

$show_more_auto = $params->get('show_more_auto', 0 );
//---------------------------------------------------------------------

//----- Parameters - Display Modifier ( 14 ) --------------------------------

$scroll_direction = $params->get('scroll_direction', "no");
$scroll_mouse_ctrl = $params->get('scroll_mouse_ctrl', "1");

$scroll_height = $params->get('scroll_height' , 100 );
$scroll_speed = $params->get('scroll_speed' , 1 );
$scroll_delay = $params->get('scroll_delay' , 30 );

$show_title_nextline = $params->get('show_title_nextline', 0 );

$filter_text = $params->get('filter_text' , 0 );
$length_limit_text = $params->get('length_limit_text' );

$filter_title = $params->get('filter_title' , 0 );
$length_limit_title = $params->get('length_limit_title' );

$format_date = $params->get('format_date', JText::_("%H:%M"));

$link_section = $params->get('link_section',   $globalConfig->get('link_section') );
$link_category = $params->get('link_category', $globalConfig->get('link_category') );

$link_titles = $params->get('link_titles', $globalConfig->get('link_titles') );
$link_text = $params->get('link_text' , 1 );
$format = $params->get('format', "%t<br>%s - %c<br>%d - %a<br>%p%i<br>%m<span class=\"article_separator\"> </span>");
$row_template = $params->get('row_template',
"(\$title_out.\$hits_out<>'' ? '<table><tr>' : '').
(\$title_out<>'' ? \"<td>\$title_out</td>\" : '').
(\$hits_out<>'' ? \"<td>(\$hits_out)</td>\" : '').
(\$title_out.\$hits_out<>'' ? '</tr></table>' : '').
(\$rate_out<>'' ? \"\$rate_out\" : '').
(\$sec_out<>'' ? \"\$sec_out\" : '').
(\$sec_out<>'' && \$cat_out<>'' ? '-' : '').
(\$cat_out<>'' ? \"\$cat_out\" : '').
(\$sec_out.\$cat_out<>'' ? '<br>' : '').
(\$author_out<>'' ? \"\$author_out\" : '' ).
(\$author_out<>'' && \$date_out<>'' ? ' - ' : '').
(\$date_out<>'' ? \"\$author_out\" : '').
(\$author_out.\$date_out<>'' ? '<br>' : '').
(\$img_out<>'' ? \"\$img_out\" : '').
(\$text_out<>'' ? \"\$text_out\" : '').
(\$readmore_out<>'' ? \"<br>\$readmore_out\" : '').
'<span class=\"article_separator\"> </span>'
" );


$use_rows_template = $params->get('use_rows_template', 1);

$module_template = $params->get('module_template', "( \$rows_out <> '' ?
(\$mod_title_out <> '' ? \"\$mod_title_out\" : '').
(\$mod_descr_out <> '' ? \"\$mod_descr_out\" : '' ).
\$mod_start_out.
\$rows_out.
\$mod_end_out.
(\$mod_automore_out <> '' ? \$mod_automore_out :'' )
: '' )
");

// $show_full_text = $params->get('show_full_text', 0);
$ordering = $params->get('ordering', "mostrecent");
$style = $params->get('style', "flat");

$show_readmore = $params->get('show_readmore', 2 );

$this->moduleclass_sfx = $params->get('moduleclass_sfx', "" );

//----- Parameters - Display Text ( 10 ) -------------------------------------
// Allows for multilingual customisation //
$text_module_description        = $params->get('text_module_description');
$text_readmore                          = $params->get('text_readmore');
$text_more                                      = $params->get('text_more', JText::_('More Articles...') );

//$text_title_auto_pre          = $params->get('text_title_auto_pre', "");
//$text_title_auto_suf          = $params->get('text_title_auto_suf', "");

$text_hover_section             = $params->get('text_hover_section', "");
$text_hover_category            = $params->get('text_hover_category', "");
$text_hover_title               = $params->get('text_hover_title', "");

$text_hover_readmore            = $params->get('text_hover_readmore', "");

$text_hover_more_section        = $params->get('text_hover_more_section', "");
$text_hover_more_category       = $params->get('text_hover_more_category', "");

$bottom_link_text = $params->get('bottom_link_text' );
$bottom_link_url = $params->get('bottom_link_url' );

$show_section  = $params->get('show_section', $globalConfig->get('show_section'));
$show_category = $params->get('show_category', $globalConfig->get('show_category'));
$show_date     = $params->get('show_date', ($use_modify_date == 1 ? $globalConfig->get('show_modify_date') : $globalConfig->get('show_create_date'))   );
$show_title    = $params->get('show_title', $globalConfig->get('show_title') );
$show_hits     = $params->get('show_hits', $globalConfig->get('show_hits') );
$show_author   = $params->get('show_author', $globalConfig->get('show_author'));
$show_text     = $params->get('show_text', 1);
$show_vote     = $params->get('show_vote', $globalConfig->get('show_vote') );

$plugins_disable   = $params->get('plugins_disable', 0 );
$set_column        = $params->get('set_column', 1 );
/* if (!$set_column) {
        $set_column = 1;
} */
$multi_column_order  = $params->get('multi_column_order', 0 );

//---------------------------------------------------------------------

//  Conflict Handler

/*
      $pf =0;

      for ( $i=0; $i < strlen( $format); $i += 1 ) {
            if ( $format[$i] == "%" ) {
               $pf = 1;
            } else {
               if ( $pf==1 ) {
                  $pf = 0;
                  switch ( $format[$i] ) {
                  case "s":
                     $show_section = 1;
                     break;
                  case "c":
                     $show_category = 1;
                     break;
                  case "d":
                     $show_date = 1;
                     break;
                  case "t":
                     $show_title = 1;
                     break;
                  case "h":
                     $show_hits = 1;
                     break;
                  case "a":
                     $show_author = 1;
                     break;
                  case "i":
                     $show_text = 1;
                     break;
                  case "r":
                     $show_vote = 1;
                     break;
                  case "%":
                     break;
                  default:
                  } // switch
               } // if ( pf
            } // if ( $format[i] == "%" )
      } // for

*/

$limit = "\n LIMIT $minus_leading, $set_count";

//
if ($set_section_id_extra) {
if ( !is_array($set_section_id) ) {
$set_section_id = (array)$set_section_id;
}

$set_section_id = array_merge($set_section_id, explode( ',', $set_section_id_extra ));
 }

if ($set_category_id_extra) {
if ( !is_array($set_category_id)) {
$set_category_id = (array)$set_category_id;
}

$set_category_id = array_merge($set_category_id, explode( ',', $set_category_id_extra ));
 }

//---------------------------------------------------------------------

//---------------------------------------------------------------------

//  Functinality to allow text_hover to be blank by use if special character "#" entered
//  If not then space added to the end of the variables
modDisplayNewsHelper::dn_hovertext( $text_hover_section );
modDisplayNewsHelper::dn_hovertext( $text_hover_category );
modDisplayNewsHelper::dn_hovertext( $text_hover_title );
modDisplayNewsHelper::dn_hovertext( $text_hover_readmore );
modDisplayNewsHelper::dn_hovertext( $text_hover_more_section );
modDisplayNewsHelper::dn_hovertext( $text_hover_more_category );
modDisplayNewsHelper::dn_hovertext( $text_title_auto_pre );
modDisplayNewsHelper::dn_hovertext( $text_title_auto_suf );
//---------------------------------------------------------------------

// $blog = $section_link_blog ? "blog" : "";

$view = JRequest::getCmd('view');

$db             =& JFactory::getDBO();


// If { set_auto = y } then Module will automatically determine section/category id of current page and use this to control what news is dsiplayed
if ($set_auto) {

   if ($view == "section") {
                $temp                           = JRequest::getString('id');
                $temp                           = explode(':', $temp);
                $zsectionid         = $temp[0];
        $set_section_id     = $zsectionid;
        } elseif ($view == "category") {
                $temp                           = JRequest::getString('id');
                $temp                           = explode(':', $temp);
                $zcategoryid        = $temp[0];
        $set_category_id = $zcategoryid;
        } elseif ($view == "article") {
                $temp                           = JRequest::getString('id');
                $temp                           = explode(':', $temp);
        $zcontentid         = $temp[0];

                $temp = & JTable::getInstance( 'content' );
        $temp->load( $zcontentid );
        $set_category_id = $temp->catid;
        } else {
                return;
        }
}



// If { set_auto_author = y } then Module will automatically determine Author id of current page and use this to control what news is dsiplayed
if ($set_auto_author) {

    if ($view == "article") {
                $temp                           = JRequest::getString('id');
                $temp                           = explode(':', $temp);
        $zcontentid         = $temp[0];

                $result = null;
                $query = "SELECT created_by_alias, created_by, title FROM #__content WHERE id = '$zcontentid'";
                $db->setQuery($query);
                $result = $db->loadObject();

                switch ( $set_auto_author ) {
                case 1: // by article author
                        if ( $result->created_by_alias ) {
                                $set_author_name = $result->created_by_alias;
                        } else {
                                $db->setQuery("SELECT name FROM #__users WHERE id = ".$result->created_by );
                                $result = $db->loadObject();
                                $set_author_name = $result->name;
                        }
                        break;

                case 2: // by article name
                        $set_author_name = $result->title;
                        break;
                 }
        } else {
                return;
        }
}

if ($view == "article") {
                $temp                           = JRequest::getString('id');
                $temp                           = explode(':', $temp);
        $currcontentid      = $temp[0];
}



//---------------------------------------------------------------------

global $mainframe;
$config =& JFactory::getConfig();
$tzoffset = $config->getValue('config.offset');


//  Special variable used for management of different access levels
$access  = !$mainframe->getCfg( 'shownoauth' );

//  Handling required to create set Names, '' added
//---------------------------------------------------------------------

//  Special Handling to get $set_date_month to work correctly
if ($set_date_month != "") {
   if ($set_date_month == "0") {
      $set_date_month = date( "m", time()+$tzoffset*60*60 );
   }
}
//---------------------------------------------------------------------

//  Special Handling to get $set_date_year to work correctly
if ($set_date_year != "") {
   if ($set_date_year == 0) {
      $set_date_year = date( "Y", time()+$tzoffset*60*60 );
   }
}

//---------------------------------------------------------------------

######################################################################################################################################

//  Main Query & Array
switch ( $ordering ) {
case "mostread":
   $order_by = "a.hits DESC";
   break;
case "publish_up":
   $order_by = "a.publish_up DESC";
   break;
case "publish_down":
   $order_by = "publish_down_isnull asc, a.publish_down asc";
   break;
case "ordering":
   $order_by = "a.ordering ASC";
   break;
case "frontpageordering":
   $order_by = "b.ordering ASC";
   break;
case "title":
   $order_by = "a.title ASC";
   break;
case "mostold":
   $order_by = "created_isnull ASC, a.created ASC";
   break;
case "random":
   $order_by = "RAND()";
   break;
case "rating":
   $order_by = "(v.rating_sum / v.rating_count) DESC, v.rating_count DESC";
   break;
case "voting":
   $order_by = "v.rating_count DESC, (v.rating_sum / v.rating_count) DESC";
   break;
case "recentlymodified":
        $order_by = "a.modified DESC";
        break;
case "mostrecent":
default:
   $order_by = "a.created DESC";
}

$my =& JFactory::getUser();

$date =& JFactory::getDate();
$now = $date->toMySQL();
$nullDate = $db->getNullDate();


#modDisplayNewsHelper::dn_set_name( $set_section_id );
#modDisplayNewsHelper::dn_set_name( $set_category_id );
$set_author_name_for_select = modDisplayNewsHelper::dn_set_name( $set_author_name);


$query = "SELECT a.id ".
                ', CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug'.
                ', CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'.
                ', a.attribs'.
($show_title ? ", a.title" : "" ).
($show_text  ? ", a.introtext as introtext" : "" ).
// (($show_text &&  $show_full_text)? ", CONCAT(a.introtext, a.fulltext ) as text" : "" ).
( ($show_text > 1 || $show_readmore == 2 )? ", a.fulltext" : "" ).
                          ", a.sectionid ".
                          ", a.catid ".
($show_date   ? ", a.$created as created" : "" ).
($ordering == "publish_down" ? ', IF(publish_down = "0000-00-00 00:00:00", 1, 0) AS publish_down_isnull ' : '' ).
($ordering == "mostold"      ? ', IF(a.'.$created.' = "0000-00-00 00:00:00", 1, 0) AS created_isnull ' : '' ).
($show_author ? ', CASE WHEN CHAR_LENGTH(a.created_by_alias) THEN created_by_alias ELSE c.name END as author' : '' ).
($show_hits   ? ", a.hits" : "" ).
($show_image ? ", a.images" : "" )
.($show_vote ? ",round( v.rating_sum / v.rating_count ) AS rating, v.rating_count" : "" )

.( $show_more_auto || $show_section  || $show_category || $set_auto ?
                                        ', d.id as sec_id, d.title as sec_title, d.published as sec_published,
                                        cc.id as cat_id, cc.title as cat_title, cc.alias as cat_alias, cc.published as cat_published ' : '' )

.                                                               "\n FROM #__content AS a"
. ( ($show_frontpage == "n" || $show_frontpage == "only" )? "\n LEFT JOIN #__content_frontpage AS b ON b.content_id = a.id" : "" )
. ( ( $set_author_name<>"" || $show_author )            ? "\n JOIN #__users AS c ON c.id = a.created_by" : "" )
.                       "\n INNER JOIN #__categories AS cc ON cc.id = a.catid"
.           "\n INNER JOIN #__sections AS d ON d.id = a.sectionid"
   . ( ($show_vote || $ordering == "rating" || $ordering == "voting" )?
                                                                "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" : "" )
   .                                                            "\n  WHERE (a.state = '1')"
   . ( ($publish_up_spec == "" )?       "\n  AND (a.publish_up = ".$db->Quote($nullDate)." OR a.publish_up <= ".$db->Quote($now)."  )" : "")
   . ( ($publish_up_spec == "p" )?      "\n  AND ( a.publish_up > ".$db->Quote($now)."  )" : "")
   .                                                            "\n  AND (a.publish_down = ".$db->Quote($nullDate)." OR a.publish_down >= ".$db->Quote($now)."  )"
   .                                                            "\n AND (d.published = '1')"
   .                                                            "\n AND (cc.published = '1')"
   . ($set_section_id ?         "\n   AND (a.sectionid IN (".(is_array($set_section_id)? implode(",",$set_section_id) : $set_section_id).") )" : '')
   . ( $set_category_id
                ?       "\n   AND (a.catid IN ( ".(is_array( $set_category_id )? implode(",",$set_category_id) : $set_category_id )." ) )" : '')
   . ($show_frontpage == "n" ?                                  "\n  AND (b.content_id IS NULL)" : '')
   . ($show_frontpage == "only" ?                               "\n  AND (b.content_id = a.id)" : '')
   . ($set_article_id ?                                         "\n  AND (a.id IN ($set_article_id) )" : '')
   . ($hide_current && $view == "article"?                      "\n  AND (a.id <> ($currcontentid) )" : '')
   . ($set_author_id <> "" ?                                            "\n  AND (a.created_by IN ($set_author_id) )" : '')
   . ($set_author_name <> "" ?                                  "\n  AND ((a.created_by_alias IN (".$set_author_name_for_select.")) OR
                                                                               ((a.created_by_alias = '' ) AND ( c.name IN (".$set_author_name_for_select."))) )" : '')
   . ($set_date_newly ?                                 "\n  AND (TO_DAYS(ADDDATE(NOW(), INTERVAL $tzoffset HOUR)) - TO_DAYS(ADDDATE($created, INTERVAL $tzoffset HOUR)) <= '$set_date_newly' )" : '')
   . ($set_date_older ?                                 "\n  AND (TO_DAYS(ADDDATE(NOW(), INTERVAL $tzoffset HOUR)) - TO_DAYS(ADDDATE($created, INTERVAL $tzoffset HOUR)) >= '$set_date_older' )" : '')

   . ($set_date_today ?                                         "\n   AND (TO_DAYS(ADDDATE(NOW(), INTERVAL $tzoffset HOUR)) = TO_DAYS(ADDDATE($created, INTERVAL $tzoffset HOUR)))" : '')
   . ($set_date_month ?                                         "\n  AND ($set_date_month = MONTH(ADDDATE($created, INTERVAL $tzoffset HOUR)))" : '')
   . ($set_date_year ?                                  "\n  AND ($set_date_year  = YEAR(ADDDATE($created, INTERVAL $tzoffset HOUR)))" : '')
   . ( isset($access)? "\n AND a.access <= '".$my->get('gid')."'" : '' )
#******************************************#
//  This Controls the fact that this module displayes the Latest News first
   . "\n  ORDER BY $order_by"
#******************************************#
   . "\n $limit;"
;

$db =& JFactory::getDBO();



$db->setQuery( $query );

$rows = $db->loadObjectList();

######################################################################################################################################

   $mod_title_out = "";
   $mod_descr_out = "";
   $mod_start_out = "";
   $mod_end_out = "";
   $mod_automore_out = "";
   $rows_out = "";

   //  Error checker, that tests whether any data has resulted from the query
//  If not an Error message is displayed
if ($rows <> NULL) {

      // Code for displaying of individual items Section


        if ($show_more_auto ) {
      if  ( is_array($set_section_id) && !is_array( $set_category_id) )  {
         // $more_section = & JTable::getInstance( 'section' );
         // $more_section->load( $set_section_id_extra );
         $mod_automore_out .= "<span ".modDisplayNewsHelper::dn_style("dn-more").">";
         $mod_automore_out .= "<a href='".JRoute::_(ContentHelperRoute::getSectionRoute($rows[0]->sec_id))."' ".modDisplayNewsHelper::dn_style("dn-more")." ";
         if ( $show_tooltips ) {
                 $mod_automore_out .= "title=\"".htmlspecialchars($text_hover_more_section.$rows[0]->sec_title)."\"";
             }
    
*

BK

  • Захожу иногда
  • 79
  • 4 / 0
Код менять необходимости нет. В настройках "Date format" можно указывать и дату и время. Полный список опций здесь: http://php.net/manual/en/function.strftime.php
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

[РЕШЕНО] Падает Joomla 3.8 после обновления из за DisplayNews

Автор mgyie

Ответов: 24
Просмотров: 3166
Последний ответ 13.10.2017, 14:06:15
от erakon
Настройка категории в модуле Display News 1.7

Автор freedomnow

Ответов: 1
Просмотров: 2801
Последний ответ 25.04.2012, 02:53:48
от BK
не работает ни один новостной модуль в том числе и Display News

Автор serg0071

Ответов: 2
Просмотров: 3171
Последний ответ 01.02.2012, 22:25:32
от serg0071
Как отредактировать CSS в Display News?

Автор toliknu

Ответов: 2
Просмотров: 3403
Последний ответ 01.12.2011, 17:40:20
от toliknu
Нестандартный вывод даты

Автор Kartowka

Ответов: 6
Просмотров: 2032
Последний ответ 31.07.2011, 03:39:36
от Dorfman