indexSuccess.php 1.53 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
slot('title', __('Читать'));
include_partial('main/breadcrumbs');
echo '<h1 class="content_title">' . __('Читать') . '</h1>';
include_component('main', 'tag');
?>
<div class="article_item_gutter" style="width: 100%; text-align: center">
    <?php
    if (count($articles) >= sfConfig::get('app_view_count_tag'))
    {
        echo '<a data-tag-id="all" class="article_show_tag green_link ' . (!$tag_id || $tag_id == 'all' ? 'active' : '') . '">Все</a>';
        foreach ($articles_tags as $tag)
        {
            echo '<a class="article_show_tag green_link ' . ($tag_id == $tag['id'] ? 'active' : '') . '" data-tag-id="' . $tag['id'] . '">' . $tag['Translation'][$culture]['title'] . '</a>';
        }
    }
    ?>
</div>
<i class="br20 mobile_hide"></i>
<div class="articles_wrap">
    <?php include_partial("article/article", array('articles' => $articles)); ?>
</div>
<script>
    var culture = '<?php echo $culture ?>';
    $('body').on('click', '.article_show_tag', function () {
        //alert('123');
        _this = this;
        $.ajax({
            url: '/' + culture + '/article/',
            type: 'get',
            data: {tag_id : $(this).attr('data-tag-id'), ajax : 1},
            success: function (html) {
                $('.article_show_tag').removeClass('active');
                $(_this).addClass('active');
                $('.articles_wrap').html(html);
                setUrlHash('?tag_id='+$(_this).attr('data-tag-id'));
            }

        });

        //alert($(this).attr('data-tag-id'));
    });

</script>