<?
if($result_code == '0000') {
    echo '0000|||||';
    if(count($list) > 0) {
        $i = 1;
        $list1 = array();
        $list2 = array();
        $list3 = array();
        foreach($list as $val) {
            if($i%3 == 1) $list1[] = array('idx'=> $val['idx'], 'main_img' => $val['main_img'], 'sub_title'=>  $val['sub_title'], 'title'=> $val['title'], 'hit_count'=> $val['hit_count'], 'comment_count'=> $val['comment_count']);
            if($i%3 == 2) $list2[] = array('idx'=> $val['idx'], 'main_img' => $val['main_img'], 'sub_title'=>  $val['sub_title'], 'title'=> $val['title'], 'hit_count'=> $val['hit_count'], 'comment_count'=> $val['comment_count']);
            if($i%3 == 0) $list3[] = array('idx'=> $val['idx'], 'main_img' => $val['main_img'], 'sub_title'=>  $val['sub_title'], 'title'=> $val['title'], 'hit_count'=> $val['hit_count'], 'comment_count'=> $val['comment_count']);

            $i++;
        }
?>


        <?
            if(count($list1) > 0) {
                $i = 1;
                foreach($list1 as $val) {
                    $style = 'style="display:none;"';

        ?>
                    <li class="life_box item1_<?=$page?>" id="item_1_<?=$val['idx']?>" <?=$style?>>
                        <a href="/web/life/life_view/<?=$val['idx']?>"><img src="<?=$val['main_img']?>" width="226"></a>
                        <p class="life_info"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['sub_title']?></a></p>
                        <p class="life_title"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['title']?></a></p>
                        <p class="life_click"><span>조회 <?=number_format($val['hit_count'])?></span>   <span>댓글수 <?=number_format($val['comment_count'])?></span></p>
                    </li>
        <?			$i++;
                }
            }
        ?>
        |||||
        <?
            if(count($list2) > 0) {
                $i = 1;
                foreach($list2 as $val) {
                    $style = 'style="display:none;"';


        ?>
                    <li class="life_box2 item2_<?=$page?>" id="item_2_<?=$val['idx']?>" <?=$style?>>
                        <a href="/web/life/life_view/<?=$val['idx']?>"><img src="<?=$val['main_img']?>" width="226"></a>
                        <p class="life_info"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['sub_title']?></a></p>
                        <p class="life_title"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['title']?></a></p>
                        <p class="life_click"><span>조회 <?=number_format($val['hit_count'])?></span>   <span>댓글수 <?=number_format($val['comment_count'])?></span></p>
                    </li>
        <?
                    $i++;
                }
            }
        ?>
        |||||
        <?
            if(count($list3) > 0) {
                $i = 1;
                foreach($list3 as $val) {
                    $style = 'style="display:none;"';

        ?>
                    <li class="life_box3 item3_<?=$page?>" id="item_3_<?=$val['idx']?>" <?=$style?>>
                        <a href="/web/life/life_view/<?=$val['idx']?>"><img src="<?=$val['main_img']?>" width="226"></a>
                        <p class="life_info"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['sub_title']?></a></p>
                        <p class="life_title"><a href="/web/life/life_view/<?=$val['idx']?>"><?=$val['title']?></a></p>
                        <p class="life_click"><span>조회 <?=number_format($val['hit_count'])?></span>   <span>댓글수 <?=number_format($val['comment_count'])?></span></p>
                    </li>
        <?		}
            }

    }




    echo '|||||'.$total_count.'|||||'.$more_list;

} else {
    echo $result_code.'|||||글가져오기에 실패했습니다.';

}
?>