Пример #1
0
 protected function pages()
 {
     $kirby = $this->kirbyInstance();
     $site = $this->siteInstance($kirby);
     $a = $site->find('a');
     $b = $site->find('b');
     $home = $site->find('home');
     $pages = new Pages();
     $pages->add($a);
     $pages->add($b);
     $pages->add($home);
     return $pages;
 }
Пример #2
0
 public function add()
 {
     if (Input::method() == 'POST') {
         if (Pages::add()) {
             return Response::redirect($this->admin_url . '/pages/edit/' . Db::insert_id());
         }
     }
     Template::render('pages/add');
 }
            foreach ($postsYear as $a) {
                if ($a->date('m') == $month) {
                    $postsMonth->add($a);
                }
            }
            // get month-name from number
            $dateObj = DateTime::createFromFormat('!m', $month);
            $monthName = $dateObj->format('F');
            // March
            $archiveTitle = ' for ' . $monthName . ' ' . $year;
            $posts = $postsMonth;
            // filter by day
            if (isset($data['day'])) {
                $day = $data['day'];
                $postsDay = new Pages();
                foreach ($postsMonth as $a) {
                    if ($a->date('d') == $day) {
                        $postsDay->add($a);
                    }
                }
                $archiveTitle = ' for ' . $day . '. ' . $monthName . ' ' . $year;
                $posts = $postsDay;
            }
        }
    }
    // add pagination
    $posts = $posts->paginate(c::get('pagination-archive'));
    $pagination = $posts->pagination();
    //pass all variables to the template
    return compact('posts', 'archiveTitle', 'data', 'pagination', 'year');
};
Пример #4
0
$page = $page->parent();
?>
<div class="content new tp-<?php 
echo $page->template();
?>
" data-parent="<?php 
echo $page->parent()->uid();
?>
" data-uid="<?php 
echo $page->uid();
?>
">
      <?php 
$collections = new Pages();
$collections->add($page->page1()->toPage());
$collections->add($page->page2()->toPage());
$collections->add($page->page3()->toPage());
$collections->add($page->page4()->toPage());
$n = 0;
foreach ($collections as $collect) {
    $n += 1;
    ?>
        <div class="slide" data-count="<?php 
    echo $n;
    ?>
">
          <img src="<?php 
    echo $collect->image()->url();
    ?>
" alt="">