მოკლე აღწერის გამოტანის მოდიფიკაცია 2024-05-03 |
ამ მოდიფიკაციის დაყენების შემდეგ, მომხმარებელს შეეძლება მოკლე აღწერის გამოტანის მოდიფიცირება: გამოტანა სიად, სურათებით, ან სტანდარტული სახით. ინსტრუქცია: main.tpl -ში ჩასვით Code [aviable=main] <script type="text/javascript"> $(function(){ if($.cookie('short_template')){ $(".templtes").removeClass('current'); $(".templater a[data-template]").removeClass('current').each(function(){ if($(this).data('template')==$.cookie('short_template')){ $(this).addClass('current'); $(".template-"+$.cookie('short_template')).addClass('current'); } }); } $(".templater a[data-template]").click(function(){ if($(this).hasClass('current')) return false; $(this).addClass('current').siblings().removeClass('current'); $(".templtes").removeClass('current'); $(".template-"+$(this).data('template')).addClass('current'); $.cookie('short_template', $(this).data('template'),{path:'/'}); window.location.href=dle_root+'?short_template'+$(this).data('template'); return false; }); }) </script> <div class="sortn dpad"><div class="sortn"><div class="templater">Режим просмотра: <a href="#" class="current" data-template="default">Стандарт</a> | <a href="#" data-template="list">Список</a> | <a href="#" data-template="icons">Иконки</a></div></div></div> [/aviable] დავამატოთ სტილები: Code .templater .current{color:#c00;} .templtes{display:none;} .templtes.current{display:block;} გადმოწერეთ არქივი და გაწერეთ: jquery.cookie.js თქვენ არ შეგიძლიათ ფაილების გადმოწერა სერვერიდან Code <script type="text/javascript" src="{THEME}/js/jquery.cookie.js"></script> გავხსნათ ფაილი engine/modules/show.short.php ვაკომენტარებთ სტრიქონს: Code /* if( isset( $view_template ) and $view_template == "rss" ) { } elseif( $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' ); */ მის ქვევით ვსვავთ: Code $user_short_tpl = array( 'default' => 'shortstory.tpl', //дефолтный шаблон 'list' => 'shortstory_list.tpl', // шаблон списком 'icons' => 'shortstory_icons.tpl' // шаблон картинки ); $user_tpl =(isset($_COOKIE['short_template']) && isset($user_short_tpl[$_COOKIE['short_template']])) ? $user_short_tpl[$_COOKIE['short_template']] : $user_short_tpl['default']; $user_tpl = (isset($_GET['short_template']) && isset($user_short_tpl[$_GET['short_template']])) ? $user_short_tpl[$_GET['short_template']] : $user_tpl; if( isset( $view_template ) and $view_template == "rss" ) { } elseif( $category_id and $cat_info[$category_id]['short_tpl'] != '' ) $tpl->load_template( $cat_info[$category_id]['short_tpl'] . '.tpl' ); else $tpl->load_template($user_tpl); |
სულ კომენტარები: 0 | |