<?php
        //$thisLink = "/arbour";
        
       
        $table="blog";
        $query = "SELECT * FROM `{$table}`  ORDER BY  RAND() DESC LIMIT 3 ";
        //$accessEdit = (isset($user['id']) ? admin :: getAccess($user,  array('a'=>3,'m_chat'=>1)) : '' );

        $q = DB :: $pdo -> query("{$query}");

        $i = 0;
        $in = 0;
        echo '<div class="app-block">';
        echo'<div class="list _center" style="text-decoration:none;"><b>Популярные блоги</b> <i class="fa fa-chevron-down"></i></div>';

            
    
        while($r = $q -> fetch()) {
            $dataUser = ($r['id_user'] == $user['id'] ? $user : profile :: getUser($r['id_user'],"*",false) );
            
              ?>
           
            
             <div class="list _l-padd-n">
            
            
            
             <div class="_l-padd">
                <div class="_oh">
                    <div class="list-flex">
                        <div class="post-l emotion-show" data-emotions="<?=system::textOut($dataUser['emotions'])?>">
                    <?=profile :: userAvatar($dataUser, 3)?>
                </div>
                        <div class="post-c">
                            <div class="_name">
                               <?=profile :: goPage($dataUser)?> <?=profile :: cake($dataUser)?>Написал блог </div>
                            <div class="_time">
                                <?=system :: times($r['time'])?>                </div>
                        </div>
                    </div>
                </div>
                             
                <div class="_gray">
                        <div>
                             <br>
                <?=emoji :: Text(system :: BBcode(system :: textOut(system::cutText($r['text']))))?>
                                        </div>
                                                <div class="_font-s">
                        </div>
                    </div>
                            </div>
            
            
            
            
            
            
            
            
                            
            <div class="tb-line"></div>
            <div class="tb-bloc">
                <div class="tb-cont tb-1">
                    <div class="tb-item"><a href="/blog?note=<?=$r['id']?>" class="tb-c">Посмотреть запись</a>
                    </div>

                </div>
            </div>
        </div>
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            

            
        
            
            
            <?php
        }
        
        echo'</div>';