вопрос
Здравствуйте!
Как создать сделать открытие новостей в дополнительных вкладках? То есть чтоб при нажатии на "Читать" в короткой новости открывалась новая вкладка.
Пробовала прописать target= _blank в show.short и show.custom, как прописано в инструкциях многих форумов-не помогло. Чистила кеш как сайта, так и браузера. Эффекта-0.
Двигатель лицензионный 10.4
Буду признательна за помощь. Спасибо
Файл short.show:
Как создать сделать открытие новостей в дополнительных вкладках? То есть чтоб при нажатии на "Читать" в короткой новости открывалась новая вкладка.
Пробовала прописать target= _blank в show.short и show.custom, как прописано в инструкциях многих форумов-не помогло. Чистила кеш как сайта, так и браузера. Эффекта-0.
Двигатель лицензионный 10.4
Буду признательна за помощь. Спасибо
Файл short.show:
<?php
/*
=====================================================
DataLife Engine - by SoftNews Media Group
-----------------------------------------------------
http://dle-news.ru/
-----------------------------------------------------
Copyright (c) 2004,2015 SoftNews Media Group
=====================================================
Данный код защищен авторскими правами
=====================================================
Файл: show.short.php
-----------------------------------------------------
Назначение: вывод новостей
=====================================================
*/
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
if( $allow_active_news ) {
if( $config['allow_banner'] ) include_once ENGINE_DIR . '/modules/banners.php';
$i = $cstart;
$global_news_count = 0;
$news_found = FALSE;
if( $category_id and $cat_info[$category_id]['short_tpl'] != '' ) $tpl->load_template( $cat_info[$category_id]['short_tpl'] . '.tpl' );
else $tpl->load_template( 'shortstory.tpl' );
if( strpos( $tpl->copy_template, "[xfvalue_" ) !== false OR strpos( $tpl->copy_template, "[xfgiven_" ) !== false ) { $xfound = true; $xfields = xfieldsload();}
else $xfound = false;
if( count( $banners ) AND $config['allow_banner'] AND !$smartphone_detected) {
$news_c = 1;
if( isset( $ban_short ) ) {
for($indx = 0, $max = sizeof( $ban_short['top'] ), $banners_topz = ''; $indx < $max; $indx ++)
if( $ban_short['top'][$indx]['zakr'] ) {
$banners_topz .= $ban_short['top'][$indx]['text'];
unset( $ban_short['top'][$indx] );
}
for($indx = 0, $max = sizeof( $ban_short['cen'] ), $banners_cenz = ''; $indx < $max; $indx ++)
if( $ban_short['cen'][$indx]['zakr'] ) {
$banners_cenz .= $ban_short['cen'][$indx]['text'];
unset( $ban_short['cen'][$indx] );
}
for($indx = 0, $max = sizeof( $ban_short['down'] ), $banners_downz = ''; $indx < $max; $indx ++)
if( $ban_short['down'][$indx]['zakr'] ) {
$banners_downz .= $ban_short['down'][$indx]['text'];
unset( $ban_short['down'][$indx] );
}
$middle = floor( $config['news_number'] / 2 );
$middle_s = floor( ($middle - 1) / 2 );
$middle_e = floor( $middle + (($config['news_number'] - $middle) / 2) + 1 );
}
}
$sql_result = $db->query( $sql_select );
if( ! isset( $view_template ) ) {
$count_all = $db->super_query( $sql_count );
$count_all = $count_all['count'];
} else
$count_all = 0;
while ( $row = $db->get_row( $sql_result ) ) {
$news_found = TRUE;
$attachments[] = $row['id'];
$row['date'] = strtotime( $row['date'] );
if( $config['allow_banner'] AND count( $banners ) ) {
foreach ( $banners as $name => $value ) {
$tpl->copy_template = str_replace( "{banner_" . $name . "}", $value, $tpl->copy_template );
if ( $value ) {
$tpl->copy_template = str_replace ( "[banner_" . $name . "]", "", $tpl->copy_template );
$tpl->copy_template = str_replace ( "[/banner_" . $name . "]", "", $tpl->copy_template );
}
}
}
$tpl->set_block( "'{banner_(.*?)}'si", "" );
$tpl->set_block ( "'\\[banner_(.*?)\\](.*?)\\[/banner_(.*?)\\]'si", "" );
if( isset( $middle ) ) {
if( $news_c == $middle_s ) {
$tpl->copy_template .= bannermass( $banners_topz, $ban_short['top'] );
} else if( $news_c == $middle ) {
$tpl->copy_template .= bannermass( $banners_cenz, $ban_short['cen'] );
} else if( $news_c == $middle_e ) {
$tpl->copy_template .= bannermass( $banners_downz, $ban_short['down'] );
}
$news_c ++;
}
$i ++;
if( ! $row['category'] ) {
$my_cat = "---";
$my_cat_link = "---";
} else {
$my_cat = array ();
$my_cat_link = array ();
$cat_list = explode( ',', $row['category'] );
if ($config['category_separator'] != ',') $config['category_separator'] = ' '.$config['category_separator'];
if( count( $cat_list ) == 1 OR ($view_template == "rss" AND $config['rss_format'] == 2)) {
$my_cat[] = $cat_info[$cat_list[0]]['name'];
$my_cat_link = get_categories( $cat_list[0], $config['category_separator']);
} else {
foreach ( $cat_list as $element ) {
if( $element ) {
$my_cat[] = $cat_info[$element]['name'];
if( $config['allow_alt_url'] ) $my_cat_link[] = "<a href=\"" . $config['http_home_url'] . get_url( $element ) . "/\">{$cat_info[$element]['name']}</a>";
else $my_cat_link[] = "<a href=\"$PHP_SELF?do=cat&category={$cat_info[$element]['alt_name']}\">{$cat_info[$element]['name']}</a>";
}
}
$my_cat_link = implode( "{$config['category_separator']} ", $my_cat_link );
}
$my_cat = implode( "{$config['category_separator']} ", $my_cat );
}
$url_cat = $category_id;
if (stripos ( $tpl->copy_template, "[category=" ) !== false) {
$tpl->copy_template = preg_replace_callback ( "#\\[(category)=(.+?)\\](.*?)\\[/category\\]#is", "check_category", $tpl->copy_template );
}
if (stripos ( $tpl->copy_template, "[not-category=" ) !== false) {
$tpl->copy_template = preg_replace_callback ( "#\\[(not-category)=(.+?)\\](.*?)\\[/not-category\\]#is", "check_category", $tpl->copy_template );
}
$category_id = $row['category'];
if( strpos( $tpl->copy_template, "[catlist=" ) !== false ) {
$tpl->copy_template = preg_replace_callback ( "#\\[(catlist)=(.+?)\\](.*?)\\[/catlist\\]#is", "check_category", $tpl->copy_template );
}
if( strpos( $tpl->copy_template, "[not-catlist=" ) !== false ) {
$tpl->copy_template = preg_replace_callback ( "#\\[(not-catlist)=(.+?)\\](.*?)\\[/not-catlist\\]#is", "check_category", $tpl->copy_template );
}
$category_id = $url_cat;
$row['category'] = intval( $row['category'] );
$news_find = array ('{comments-num}' => $row['comm_num'], '{views}' => $row['news_read'], '{category}' => $my_cat, '{link-category}' => $my_cat_link, '{news-id}' => $row['id'] );
$tpl->set( '', $news_find );
if( $row['category'] AND $cat_info[$row['category']]['icon'] ) {
$tpl->set( '{category-icon}', $cat_info[$row['category']]['icon'] );
} else {
$tpl->set( '{category-icon}', "{THEME}/dleimages/no_icon.gif" );
}
if ( $row['category'] )
$tpl->set( '{category-url}', $config['http_home_url'] . get_url( $row['category'] ) . "/" );
else
$tpl->set( '{category-url}', "#" );
if( date( 'Ymd', $row['date'] ) == date( 'Ymd', $_TIME ) ) {
$tpl->set( '{date}', $lang['time_heute'] . langdate( ", H:i", $row['date'] ) );
} elseif( date( 'Ymd', $row['date'] ) == date( 'Ymd', ($_TIME - 86400) ) ) {
$tpl->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $row['date'] ) );
} else {
$tpl->set( '{date}', langdate( $config['timestamp_active'], $row['date'] ) );
}
$news_date = $row['date'];
$tpl->copy_template = preg_replace_callback ( "#\{date=(.+?)\}#i", "formdate", $tpl->copy_template );
$global_news_count ++;
if (strpos ( $tpl->copy_template, "[newscount=" ) !== false) {
$tpl->copy_template = preg_replace_callback ( "#\\[(newscount)=(.+?)\\](.*?)\\[/newscount\\]#is", "check_newscount", $tpl->copy_template );
}
if (strpos ( $tpl->copy_template, "[not-newscount=" ) !== false) {
$tpl->copy_template = preg_replace_callback ( "#\\[(not-newscount)=(.+?)\\](.*?)\\[/not-newscount\\]#is", "check_newscount", $tpl->copy_template );
}
if ( $row['fixed'] ) {
$tpl->set( '[fixed]', "" );
$tpl->set( '[/fixed]', "" );
$tpl->set_block( "'\\[not-fixed\\](.*?)\\[/not-fixed\\]'si", "" );
} else {
$tpl->set( '[not-fixed]', "" );
$tpl->set( '[/not-fixed]', "" );
$tpl->set_block( "'\\[fixed\\](.*?)\\[/fixed\\]'si", "" );
}
if ( $row['comm_num'] ) {
$tpl->set( '[comments]', "" );
$tpl->set( '[/comments]', "" );
$tpl->set_block( "'\\[not-comments\\](.*?)\\[/not-comments\\]'si", "" );
} else {
$tpl->set( '[not-comments]', "" );
$tpl->set( '[/not-comments]', "" );
$tpl->set_block( "'\\[comments\\](.*?)\\[/comments\\]'si", "" );
}
if ( $row['votes'] ) {
$tpl->set( '[poll]', "" );
$tpl->set( '[/poll]', "" );
$tpl->set_block( "'\\[not-poll\\](.*?)\\[/not-poll\\]'si", "" );
} else {
$tpl->set( '[not-poll]', "" );
$tpl->set( '[/not-poll]', "" );
$tpl->set_block( "'\\[poll\\](.*?)\\[/poll\\]'si", "" );
}
if( strpos( $tpl->copy_template, "{poll}" ) !== false AND $view_template != "rss" ) {
if( $row['votes'] ) {
include ENGINE_DIR . '/modules/poll.php';
$tpl->set( '{poll}', $tpl->result['poll'] );
} else {
$tpl->set( '{poll}', '' );
}
}
if( $row['view_edit'] and $row['editdate'] ) {
if( date( Ymd, $row['editdate'] ) == date( Ymd, $_TIME ) ) {
$tpl->set( '{edit-date}', $lang['time_heute'] . langdate( ", H:i", $row['editdate'] ) );
} elseif( date( Ymd, $row['editdate'] ) == date( Ymd, ($_TIME - 86400) ) ) {
$tpl->set( '{edit-date}', $lang['time_gestern'] . langdate( ", H:i", $row['editdate'] ) );
} else {
$tpl->set( '{edit-date}', langdate( $config['timestamp_active'], $row['editdate'] ) );
}
$tpl->set( '{editor}', $row['editor'] );
$tpl->set( '{edit-reason}', $row['reason'] );
if( $row['reason'] ) {
$tpl->set( '[edit-reason]', "" );
$tpl->set( '[/edit-reason]', "" );
} else
$tpl->set_block( "'\\[edit-reason\\](.*?)\\[/edit-reason\\]'si", "" );
$tpl->set( '[edit-date]', "" );
$tpl->set( '[/edit-date]', "" );
} else {
$tpl->set( '{edit-date}', "" );
$tpl->set( '{editor}', "" );
$tpl->set( '{edit-reason}', "" );
$tpl->set_block( "'\\[edit-date\\](.*?)\\[/edit-date\\]'si", "" );
$tpl->set_block( "'\\[edit-reason\\](.*?)\\[/edit-reason\\]'si", "" );
}
if( $config['allow_tags'] and $row['tags'] ) {
$tpl->set( '[tags]', "" );
$tpl->set( '[/tags]', "" );
$tags = array ();
$row['tags'] = explode( ",", $row['tags'] );
foreach ( $row['tags'] as $value ) {
$value = trim( $value );
if( $config['allow_alt_url'] ) $tags[] = "<a href=\"" . $config['http_home_url'] . "tags/" . urlencode( $value ) . "/\">" . $value . "</a>";
else $tags[] = "<a href=\"$PHP_SELF?do=tags&tag=" . urlencode( $value ) . "\">" . $value . "</a>";
}
$tpl->set( '{tags}', implode( ", ", $tags ) );
} else {
$tpl->set_block( "'\\[tags\\](.*?)\\[/tags\\]'si", "" );
$tpl->set( '{tags}', "" );
}
if ( $config['rating_type'] == "1" ) {
$tpl->set( '[rating-type-2]', "" );
$tpl->set( '[/rating-type-2]', "" );
$tpl->set_block( "'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", "" );
$tpl->set_block( "'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", "" );
} elseif ( $config['rating_type'] == "2" ) {
$tpl->set( '[rating-type-3]', "" );
$tpl->set( '[/rating-type-3]', "" );
$tpl->set_block( "'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", "" );
$tpl->set_block( "'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", "" );
} else {
$tpl->set( '[rating-type-1]', "" );
$tpl->set( '[/rating-type-1]', "" );
$tpl->set_block( "'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", "" );
$tpl->set_block( "'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", "" );
}
if( $row['allow_rate'] ) {
if( $config['short_rating'] AND $user_group[$member_id['user_group']]['allow_rating'] ) {
$tpl->set( '{rating}', ShowRating( $row['id'], $row['rating'], $row['vote_num'], 1 ) );
if ( $config['rating_type'] ) {
$tpl->set( '[rating-plus]', "<a href=\"#\" onclick=\"doRate('plus', '{$row['id']}'); return false;\" >" );
$tpl->set( '[/rating-plus]', '</a>' );
if ( $config['rating_type'] == "2" ) {
$tpl->set( '[rating-minus]', "<a href=\"#\" onclick=\"doRate('minus', '{$row['id']}'); return false;\" >" );
$tpl->set( '[/rating-minus]', '</a>' );
} else {
$tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" );
}
} else {
$tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" );
$tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" );
}
} else {
$tpl->set( '{rating}', ShowRating( $row['id'], $row['rating'], $row['vote_num'], 0 ) );
$tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" );
$tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" );
}
$tpl->set( '{vote-num}', "<span id=\"vote-num-id-".$row['id']."\" class=\"ignore-select\">".$row['vote_num']."</span>" );
$tpl->set( '[rating]', "" );
$tpl->set( '[/rating]', "" );
} else {
$tpl->set( '{rating}', "" );
$tpl->set( '{vote-num}', "" );
$tpl->set_block( "'\\[rating\\](.*?)\\[/rating\\]'si", "" );
$tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" );
$tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" );
}
if( $config['allow_alt_url'] ) {
$go_page = $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/";
$tpl->set( '[day-news]', "<a href=\"".$config['http_home_url'] . date( 'Y/m/d/', $row['date'])."\" >" );
} else {
$go_page = "$PHP_SELF?subaction=userinfo&user=" . urlencode( $row['autor'] );
$tpl->set( '[day-news]', "<a href=\"$PHP_SELF?year=".date( 'Y', $row['date'])."&month=".date( 'm', $row['date'])."&day=".date( 'd', $row['date'])."\" >" );
}
$tpl->set( '[/day-news]', "</a>" );
$tpl->set( '[profile]', "<a href=\"" . $go_page . "\">" );
$tpl->set( '[/profile]', "</a>" );
$tpl->set( '{login}', $row['autor'] );
$tpl->set( '{author}', "<a onclick=\"ShowProfile('" . urlencode( $row['autor'] ) . "', '" . $go_page . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\" href=\"" . $go_page . "\">" . $row['autor'] . "</a>" );
if( $allow_userinfo and ($member_id['name'] == $row['autor'] and ! $user_group[$member_id['user_group']]['allow_all_edit']) ) {
$tpl->set( '[edit]', "<a href=\"" . $config['http_home_url'] . "index.php?do=addnews&id=" . $row['id'] . "\" >" );
$tpl->set( '[/edit]', "</a>" );
} elseif( $is_logged and (($member_id['name'] == $row['autor'] and $user_group[$member_id['user_group']]['allow_edit']) or $user_group[$member_id['user_group']]['allow_all_edit']) ) {
$_SESSION['referrer'] = $_SERVER['REQUEST_URI'];
$tpl->set( '[edit]', "<a onclick=\"return dropdownmenu(this, event, MenuNewsBuild('" . $row['id'] . "', 'short'), '170px')\" href=\"#\">" );
$tpl->set( '[/edit]', "</a>" );
$allow_comments_ajax = true;
} else
$tpl->set_block( "'\\[edit\\](.*?)\\[/edit\\]'si", "" );
if( $config['allow_alt_url'] ) {
if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) {
if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
if( ($row['full_story'] < 13) AND $config['hide_full_link'] ) $tpl->set_block( "'\\[full-link\\](.*?)\\[/full-link\\]'si", "" );
else {
$tpl->set( '[full-link]', "<a href=\"" . $full_link . "\">" );
$tpl->set( '[/full-link]', "</a>" );
}
$tpl->set( '{full-link}', $full_link );
if( $row['allow_comm'] ) {
$tpl->set( '[com-link]', "<a href=\"" . $full_link . "#comment\">" );
$tpl->set( '[/com-link]', "</a>" );
} else
$tpl->set_block( "'\\[com-link\\](.*?)\\[/com-link\\]'si", "" );
if( $is_logged ) {
$fav_arr = explode( ',', $member_id['favorites'] );
if( ! in_array( $row['id'], $fav_arr ) or $config['allow_cache']) {
$tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&doaction=add&id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/plus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 0); return false;\" title=\"" . $lang['news_addfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\" /></a>" );
$tpl->set( '[add-favorites]', "<a id=\"fav-id-" . $row['id'] . "\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 1); return false;\" href=\"$PHP_SELF?do=favorites&doaction=add&id=" . $row['id'] . "\">" );
$tpl->set( '[/add-favorites]', "</a>" );
$tpl->set_block( "'\\[del-favorites\\](.*?)\\[/del-favorites\\]'si", "" );
} else {
$tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&doaction=del&id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/minus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'minus', 0); return false;\" title=\"" . $lang['news_minfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\" /></a>" );
$tpl->set( '[del-favorites]', "<a id=\"fav-id-" . $row['id'] . "\" onclick=\"doFavorites('" . $row['id'] . "', 'minus', 1); return false;\" href=\"$PHP_SELF?do=favorites&doaction=del&id=" . $row['id'] . "\">" );
$tpl->set( '[/del-favorites]', "</a>" );
$tpl->set_block( "'\\[add-favorites\\](.*?)\\[/add-favorites\\]'si", "" );
}
$tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'news')\">" );
$tpl->set( '[/complaint]', "</a>" );
} else {
$tpl->set( '{favorites}', "" );
$tpl->set_block( "'\\[complaint\\](.*?)\\[/complaint\\]'si", "" );
$tpl->set_block( "'\\[add-favorites\\](.*?)\\[/add-favorites\\]'si", "" );
$tpl->set_block( "'\\[del-favorites\\](.*?)\\[/del-favorites\\]'si", "" );
}
if( $allow_userinfo) {
$tpl->set( '{approve}', $lang['approve'] );
} else
$tpl->set( '{approve}', "" );
// Обработка дополнительных полей
if( $xfound ) {
$xfieldsdata = xfieldsdataload( $row['xfields'] );
foreach ( $xfields as $value ) {
$preg_safe_name = preg_quote( $value[0], "'" );
if ( $value[6] AND !empty( $xfieldsdata[$value[0]] ) ) {
$temp_array = explode( ",", $xfieldsdata[$value[0]] );
&