<?php $this->load->view('templates/news/news-header')?>

<main id="main" role="main" tabindex="-1">
    <div class="container">
        <div class="layout-blog">
            <div>
                <section class="news-main">
                    <a href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[0]->postSeq ?>"><img
                            src="<?php echo $sortByPosted[0]->postImage?>"></a>
                    <div class="newsCont">
                        <h2><a
                                href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[0]->postSeq ?>"><?php echo $sortByPosted[0]->postTitle ?></a>
                        </h2>
                        <p><a href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[0]->postSeq ?>">
                                <?php echo $sortByPosted[0]->postExcerpt ?>
                            </a></p>
                        <ul>
                            <li><a
                                    href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[1]->postSeq ?>"><?php echo $sortByPosted[1]->postTitle ?></a>
                            </li>
                            <li><a
                                    href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[2]->postSeq ?>"><?php echo $sortByPosted[2]->postTitle ?></a>
                            </li>
                            <li><a
                                    href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[3]->postSeq ?>"><?php echo $sortByPosted[3]->postTitle ?></a>
                            </li>
                            <li><a
                                    href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[4]->postSeq ?>"><?php echo $sortByPosted[4]->postTitle ?></a>
                            </li>
                            <li><a
                                    href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $sortByPosted[5]->postSeq ?>"><?php echo $sortByPosted[5]->postTitle ?></a>
                            </li>
                        </ul>
                    </div>
                </section>

                <?php foreach ($posts as $p) { ?>

                <div class="news-list">
                    <a href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $p->postSeq ?>"><img
                            src="<?php echo $p->postImage?>"></a>
                    <div class="newsCont">
                        <h2><a
                                href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $p->postSeq ?>"><?php echo $p->postTitle ?></a>
                        </h2>
                        <p><a
                                href="/news/<?php echo $this->uri->segment(2) ?>/<?php echo $p->postSeq ?>"><?php echo $p->postExcerpt ?></a>
                        </p>
                    </div>
                </div>
                <?php } ?>
                <div class="pagenumber">
                    <?php echo $this->pagination->create_links(); ?>
                </div>
            </div>

            <!-- side bar -->
            <div class="sidebar">
                <div class="ad gap-bottom-sm"><a href=""><img
                            src="https://crossmap.co.kr/files/advertisement/2019/04/b65bc12d9a44a20ea93b4680a800652c.png"
                            alt="" width="300" height="260"></a></div>

                <section class="realtime-rank gap-bottom-md" id="list">
                    <header class="row-header">
                        <h2>많이 본 뉴스</h2>
                        <div class="viewall">
                            <span>
                                <a href="javascript:sideNewsRankNav(-1)"><img
                                        src="<?php echo THEME_FOLDER?>/img/img_section_left.jpg"></a><a
                                    href="javascript:sideNewsRankNav(1)"><img
                                        src="<?php echo THEME_FOLDER?>/img/img_section_right.jpg"></a>
                            </span>
                        </div>
                    </header>
                    <div class="rank-list">
                        <ol class="col-item side-news-rank page1">
                            <?php
                                for ($i = 0; $i < 9; $i++) {
                                    echo '<li><a href="/news/'. $this->uri->segment(2). '/'. $hotNews[$i]->postSeq . '">' . $hotNews[$i]->postTitle . '</a></li>';                                    
                                }                                   
                                ?>
                        </ol>
                        <ol class="col-item side-news-rank page2" start="10">
                            <?php                                
                                for ($i = 9; $i < 18; $i++) {
                                    echo '<li><a href="/news/'. $this->uri->segment(2). '/'. $hotNews[$i]->postSeq. '">' . $hotNews[$i]->postTitle . '</a></li>';                                    
                                }                                 
                                ?>
                        </ol>
                        <ol class="col-item side-news-rank page3" start="20">
                            <?php                                
                                for ($i = 18; $i < 27; $i++) {
                                    echo '<li><a href="/news/'. $this->uri->segment(2). '/'. $hotNews[$i]->postSeq. '">' . $hotNews[$i]->postTitle . '</a></li>';                                    
                                } 
                                ?>
                        </ol>
                    </div>
                </section>

                <!--오늘의 포토-->
                <div class="todayPhoto">
                    <h4>
                        <a href="#">오늘의 포토</a>
                    </h4>
                    <div class="photoBox"
                        style="background:url('<?php echo $photoNews[0]->postImage?>') no-repeat center; background-size:cover;">
                        <div class="bg"></div>

                        <h5><a href="/channel/<?php echo $photoNews[0]->pageID?>/<?php echo $photoNews[0]->postID?>"
                                class="cm-photo-news-link"><?php echo $photoNews[0]->postTitle?></a></h5>

                        <ul>
                            <li class="current"
                                itemref="/channel/<?php echo $photoNews[0]->pageID?>/<?php echo $photoNews[0]->postID?>"
                                title="<?php echo $photoNews[0]->postTitle?>"
                                contextmenu="<?php echo $photoNews[0]->postImage?>"
                                style="background:url('<?php echo $photoNews[0]->postImage?>') no-repeat center; background-size:cover;">
                            </li>
                            <li itemref="/channel/<?php echo $photoNews[1]->pageID?>/<?php echo $photoNews[1]->postID?>"
                                title="<?php echo $photoNews[1]->postTitle?>"
                                contextmenu="<?php echo $photoNews[1]->postImage?>"
                                style="background:url('<?php echo $photoNews[1]->postImage?>') no-repeat center; background-size:cover;">
                            </li>
                            <li itemref="/channel/<?php echo $photoNews[2]->pageID?>/<?php echo $photoNews[2]->postID?>"
                                title="<?php echo $photoNews[2]->postTitle?>"
                                contextmenu="<?php echo $photoNews[2]->postImage?>"
                                style="background:url('<?php echo $photoNews[2]->postImage?>') no-repeat center; background-size:cover;">
                            </li>
                        </ul>

                        <div class="control">
                            <div class="arrowPrev"><i class="fas fa-chevron-left"></i></div>
                            <div class="arrowNext"><i class="fas fa-chevron-right"></i></div>
                        </div>
                    </div>
                </div>
                <!--기도소식-->
                <div class="sideBox">
                    <h4>
                        <a href="#">기도소식</a>
                    </h4>
                    <ul>
                        <li class="current"
                            style="background:url('<?php echo $prayNews[0]->postImage?>') no-repeat center; background-size:cover;">
                            <a
                                href="/channel/<?php echo $prayNews[0]->pageID?>/<?php echo $prayNews[0]->postID?>"><?php echo $prayNews[0]->postTitle?></a>
                        </li>
                        <li
                            style="background:url('<?php echo $prayNews[1]->postImage?>') no-repeat center; background-size:cover;">
                            <a
                                href="/channel/<?php echo $prayNews[1]->pageID?>/<?php echo $prayNews[1]->postID?>"><?php echo $prayNews[1]->postTitle?></a>
                        </li>
                        <li
                            style="background:url('<?php echo $prayNews[2]->postImage?>') no-repeat center; background-size:cover;">
                            <a
                                href="/channel/<?php echo $prayNews[2]->pageID?>/<?php echo $prayNews[2]->postID?>"><?php echo $prayNews[2]->postTitle?></a>
                        </li>
                        <li
                            style="background:url('<?php echo $prayNews[3]->postImage?>') no-repeat center; background-size:cover;">
                            <a
                                href="/channel/<?php echo $prayNews[3]->pageID?>/<?php echo $prayNews[3]->postID?>"><?php echo $prayNews[3]->postTitle?></a>
                        </li>
                    </ul>
                </div>

                <!--banner-->
                <div class="ad gap-bottom-sm"><a href=""><img src="<?php echo THEME_FOLDER ?>/img/bn-300-webtoon.jpg"
                            alt="" width="300"></a></div>

                <div class="ad gap-bottom-sm"><a href=""><img src="<?php echo THEME_FOLDER ?>/img/bn-300-grace.jpg"
                            alt="" width="300"></a></div>

            </div>
        </div>
    </div>
</main>
<?php $this->load->view('templates/news/news-footer')?>