dimanche 25 janvier 2015

ShortMain 1.0 DLE 10,2-10,4 DLE English

ShortMain 1.0 DLE 10,2-10,4 DLE English
Setting
1) Make SQL query :
ALTER TABLE  `dle_category` ADD  `main_tpl` VARCHAR( 40 ) NOT NULL AFTER  `full_tpl`;
If you have another prefix, change dle on his own.
2) OPEN File engine/modules/show.short.php find and delete :
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 );
}
}
3) OPEN File engine/modules/show.short.php AND SEARCH :
while ( $row = $db->get_row( $sql_result ) ) {
INSERT THE FOLLOWING :
$cat_tpl = explode( ',', $row['category'] );
if($category_id and $cat_info[$category_id]['short_tpl'] != '' ) {
$tpl->load_template( $cat_info[$category_id]['short_tpl'] . '.tpl' );
} elseif( !$category_id and $cat_info[$cat_tpl[0]]['main_tpl'] != '') {
$tpl->load_template( $cat_info[$cat_tpl[0]]['main_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 );
}
}
4) OPEN file engine/inc/categories.php AND SEARCH (2 times) :
if ( $_POST['short_tpl'] ) {

$url = @parse_url ( $_POST['short_tpl'] );
$file_path = dirname (clear_url_dir($url['path']));
$tpl_name = pathinfo($url['path']);
$tpl_name = totranslit($tpl_name['basename']);

if ($file_path AND $file_path != ".") $tpl_name = $file_path."/".$tpl_name;

$short_tpl = $tpl_name;

} else $short_tpl = "";
INSERT BELOW (2 times) :
if ( $_POST['main_tpl'] ) {

$url = @parse_url ( $_POST['main_tpl'] );
$file_path = dirname (clear_url_dir($url['path']));
$tpl_name = pathinfo($url['path']);
$tpl_name = totranslit($tpl_name['basename']);

if ($file_path AND $file_path != ".") $tpl_name = $file_path."/".$tpl_name;

$main_tpl = $tpl_name;

} else $main_tpl = "";
5) OPEN file engine/inc/categories.php AND SEARCH
full_tpl='$full_tpl'
Replace with :
full_tpl='$full_tpl', main_tpl='$main_tpl'
6) OPEN file engine/inc/categories.php AND SEARCH :
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_f_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="full_tpl">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang['cat_f_tpl_hit']}" >?</span>
</div>
</div>
INSERT THE FOLLOWING :
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_m_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="main_tpl">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang[cat_m_tpl_hit]}" >?</span>
</div>
</div>
7) OPEN file engine/inc/categories.php AND SEARCH :
short_tpl, full_tpl
Replace with :
short_tpl, full_tpl, main_tpl
8) OPEN file engine/inc/categories.php AND SEARCH :
'$short_tpl', '$full_tpl'
Replace with :
'$short_tpl', '$full_tpl', '$main_tpl'
9) OPEN file engine/inc/categories.php AND SEARCH :
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_f_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="full_tpl" value="{$row['full_tpl']}">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang['cat_f_tpl_hit']}" >?</span>
</div>
</div>
INSERT THE FOLLOWING :
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_m_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="main_tpl" value="{$row['main_tpl']}">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang[cat_m_tpl_hit]}" >?</span>
</div>
</div>
10) OPEN file language/English/adminpanel.lng AND SEARCH :
'cat_f_tpl'    =>  "Full news template",
INSERT ABOVE :
'cat_m_tpl'    =>  "Pattern Short News",
'cat_m_tpl_hit' => "In addition to the appointment of a separate template for this category, you can specify only a single template file for display on the main news summary. You can leave this field blank, then it will load the standard template file <b>shortstory.tpl</b>",

All of them! Haq installed. To configure the template admin panel -> Categories. (When editing or adding appears at the bottom of the new field, enter a name in there and tpl file to display on the main news.)
screenshots

Aucun commentaire:

Enregistrer un commentaire