This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo "'" . implode("','", $arTags) . "'"; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function array_mesh() { | |
// Combine multiple associative arrays and sum the values for any common keys | |
// The function can accept any number of arrays as arguments | |
// The values must be numeric or the summed value will be 0 | |
// Get the number of arguments being passed | |
$numargs = func_num_args(); | |
// Save the arguments to an array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debug($var) | |
{ | |
ob_start(); | |
print_r($var); | |
$txt = ob_get_contents(); | |
ob_clean(); | |
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/debug.txt', $txt); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/bitrix/components/clever/empty | |
/nbproject/private/ | |
/upload/ | |
/nbproject/ | |
.gitignore | |
.tags | |
.DS_Store | |
/bitrix/components/bitrix/ | |
/bitrix/modules/ | |
/bitrix/admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.filter(name="age_declension") | |
def age_declension(age): | |
end = '' | |
num = None | |
if age >= 5 and age <= 14: | |
end = 'лет' | |
else: | |
num = (math.floor(age/10)*10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.inclusion_tag('catalog/sort.html', takes_context = True) | |
def catalog_sort(context, detail_url): | |
sort = [ | |
{'name': 'Популярности', 'sort': 'sort'}, | |
{'name': 'Цене', 'sort': 'price', 'active': False}, | |
{'name': 'Названию', 'sort': 'name', 'active': False} | |
] | |
if context['request'].GET.get('sort'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML: | |
<div class="container"> <!-- блок-контейнер --> | |
<div> <!-- блок с содержанием --> | |
Элемент, который выравнивается вертикально внутри блока-контейнера. | |
</div> | |
<div class="auxiliary"> </div> <!-- пустой вспомогательный блок --> | |
</div> | |
CSS: | |
.container { | |
display: table-cell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSS | |
.b-cols_layout_cols_2_same_height .b-cols__col_position_left{ | |
width: 50%; | |
float:left; | |
} | |
.b-cols_layout_cols_2_same_height .b-cols__col_position_right{ | |
width: 100%; | |
float:left; | |
margin:0 0 0 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django import template | |
register = template.Library() | |
@register.inclusion_tag('template.html', takes_context = True) | |
def tag(context): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
years = [str(item.active_from.year) for item in news_list] | |
dates = list(enumerate(years, start=1)) | |
result_years = [key for key,group in itertools.groupby(dates, key=lambda x: x[1][:11])] |
OlderNewer