Skip to content

Instantly share code, notes, and snippets.

@dlenettr
Created February 25, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlenettr/745ceeb3bf77b1e86114 to your computer and use it in GitHub Desktop.
Save dlenettr/745ceeb3bf77b1e86114 to your computer and use it in GitHub Desktop.
Kategoriye özel yorum şablonu atama (776)
SQL'i sorgula
--------------------8<------------------
ALTER TABLE `dle_category` ADD `comm_tpl` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
--------------------8<------------------
Dosya: engine/inc/categories.php
============================================
Bul :
--------------------8<------------------
function get_sub_cats($id, $subcategory = false) {
--------------------8<------------------
Üstüne Ekle:
--------------------8<------------------
// comm-tpl
$lang['cat_c_tpl'] = "Yorum şablonu";
$lang['cat_c_tpl_hit'] = "Kategoriye ait özel yorum şablonu kullanmak isterseniz, tpl dosyasının adını yazınız";
// comm-tpl
--------------------8<------------------
Bul ( 2 kez ):
--------------------8<------------------
} else $full_tpl = "";
--------------------8<------------------
Altına Ekle :
--------------------8<------------------
// comm-tpl
if ( $_POST['comm_tpl'] ) {
$url = @parse_url ( $_POST['comm_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;
$comm_tpl = $tpl_name;
} else $comm_tpl = "";
// comm-tpl
--------------------8<------------------
Bul :
--------------------8<------------------
$db->query( "INSERT INTO " . PREFIX . "_category (parentid, name, alt_name, icon, skin, descr, keywords, news_sort, news_msort, news_number, short_tpl, full_tpl, metatitle, show_sub, allow_rss) values ('$category', '$cat_name', '$alt_cat_name', '$cat_icon', '$skin_name', '$description', '$keywords', '$news_sort', '$news_msort', '$news_number', '$short_tpl', '$full_tpl', '$meta_title', '$show_sub', '$allow_rss')" );
--------------------8<------------------
İle değiştir :
--------------------8<------------------
$db->query( "INSERT INTO " . PREFIX . "_category (parentid, name, alt_name, icon, skin, descr, keywords, news_sort, news_msort, news_number, short_tpl, full_tpl, comm_tpl, metatitle, show_sub, allow_rss) values ('$category', '$cat_name', '$alt_cat_name', '$cat_icon', '$skin_name', '$description', '$keywords', '$news_sort', '$news_msort', '$news_number', '$short_tpl', '$full_tpl', '$comm_tpl', '$meta_title', '$show_sub', '$allow_rss')" );
--------------------8<------------------
Bul :
--------------------8<------------------
<div class="form-group">
<label class="control-label col-lg-2"></label>
<div class="col-lg-10">
<input type="submit" class="btn btn-green" value="{$lang['vote_edit']}">
</div>
</div>
--------------------8<------------------
Üstüne Ekle :
--------------------8<------------------
<!--comm-tpl-->
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_c_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="comm_tpl" value="{$row['comm_tpl']}">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang['cat_c_tpl_hit']}" >?</span>
</div>
</div>
<!--comm-tpl-->
--------------------8<------------------
Bul:
--------------------8<------------------
$db->query( "UPDATE " . PREFIX . "_category SET parentid='$parentid', name='$cat_name', alt_name='$alt_cat_name', icon='$cat_icon', skin='$skin_name', descr='$description', keywords='$keywords', news_sort='$news_sort', news_msort='$news_msort', news_number='$news_number', short_tpl='$short_tpl', full_tpl='$full_tpl', metatitle='$meta_title', show_sub='$show_sub', allow_rss='$allow_rss' WHERE id='{$catid}'" );
--------------------8<------------------
İle Değiştir :
--------------------8<------------------
$db->query( "UPDATE " . PREFIX . "_category SET parentid='$parentid', name='$cat_name', alt_name='$alt_cat_name', icon='$cat_icon', skin='$skin_name', descr='$description', keywords='$keywords', news_sort='$news_sort', news_msort='$news_msort', news_number='$news_number', short_tpl='$short_tpl', full_tpl='$full_tpl', comm_tpl='$comm_tpl', metatitle='$meta_title', show_sub='$show_sub', allow_rss='$allow_rss' WHERE id='{$catid}'" );
--------------------8<------------------
Bul :
--------------------8<------------------
<div class="form-group">
<label class="control-label col-lg-2"></label>
<div class="col-lg-10">
<input type="submit" class="btn btn-green" value="{$lang['vote_new']}">
</div>
</div>
--------------------8<------------------
Üstüne Ekle :
--------------------8<------------------
<!--comm-tpl-->
<div class="form-group">
<label class="control-label col-lg-2">{$lang['cat_c_tpl']}</label>
<div class="col-lg-10">
<input style="width:100%;max-width:200px;" type="text" name="comm_tpl">.tpl&nbsp;<span class="help-button" data-rel="popover" data-trigger="hover" data-placement="right" data-content="{$lang['cat_c_tpl_hit']}" >?</span>
</div>
</div>
<!--comm-tpl-->
--------------------8<------------------
Dosya: engine/modules/show.full.php
============================================
Bul :
--------------------8<------------------
$tpl->load_template( 'addcomments.tpl' );
--------------------8<------------------
İle Değiştir :
--------------------8<------------------
// comm-tpl
if ( $category_id and $cat_info[ $category_id ]['comm_tpl'] != '' ) $tpl->load_template( $cat_info[ $category_id ]['comm_tpl'] . '.tpl' );
else $tpl->load_template( 'addcomments.tpl' );
// comm-tpl
--------------------8<------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment