예제 #1
0
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
	info-top файл
	предыдущая - следующая запись
	вывод рубрик перед заголовком записи
*/
$np_out = '';
if (is_type('page') and $p->val('page_type_name') == 'blog') {
    $np = mso_next_prev_page(array('page_id' => $p->val('page_id'), 'page_categories' => $p->val('page_categories'), 'page_date_publish' => $p->val('page_date_publish'), 'use_category' => false));
    if ($np['next']) {
        $np_out .= '<div class="b-left"><i class="i-long-arrow-left"></i> ' . $p->link(mso_page_url($np['next']['page_slug']), $np['next']['page_title']) . '</div>';
    }
    if ($np['prev']) {
        $np_out .= '<div class="b-right">' . $p->link(mso_page_url($np['prev']['page_slug']), $np['prev']['page_title']) . ' <i class="i-long-arrow-right"></i></div>';
    }
    $p->block($np_out, '<div class="next-prev-page clearfix t90">', '</div>');
}
$p->format('edit', '<i class="i-edit t-gray600 hover-t-black" title="Edit page"></i>', '<div class="b-right mar10-t">', '</div>');
$p->format('title', '<h1 class="t-gray700 bor-double-b bor3px bor-gray300 pad5-b">', '</h1>', false);
$p->format('date', 'j F Y г.', '<time datetime="[page_date_publish_iso]" class="i-calendar">', '</time>');
$p->format('view_count', '<span class="i-eye mar15-l">' . tf('Просмотров') . ': ', '</span>');
$p->format('comments_count', '<span class="i-comment mar15-l">Комментарии: ', '</span>');
$p->format('cat', '<i class="i-bookmark-o mar10-l"></i>', '<br><span class="i-bookmark" title="' . tf('Рубрика записи') . '">', '</span>');
$p->format('tag', '<i class="i-tag mar10-l"></i>', '<br><span class="i-tags links-no-color" title="' . tf('Метка записи') . '">', '</span>');
$p->html(NR . '<header class="mar20-b">');
$p->line('[edit][title]');
$p->div_start('info info-top t-gray600 t90');
$p->line('[date][view_count][comments_count][cat][tag]');
$p->div_end('info info-top');
예제 #2
0
파일: page-out.php 프로젝트: Kmartynov/cms
 public function output($r = array())
 {
     if (!$this->pages) {
         return;
     }
     // нет записей, выходим
     // дефолтный формат вывода
     $default = array('title_start' => '<h3 class="home-last-page">', 'title_end' => '</h3>', 'date' => 'D, j F Y г. в H:i', 'date_start' => '<span class="date"><time datetime="[page_date_publish_iso]">', 'date_end' => '</time></span>', 'cat_start' => ' | <span class="cat">', 'cat_end' => '</span>', 'cat_sep' => ', ', 'tag_start' => ' | <span class="tag">', 'tag_end' => '</span>', 'tag_sep' => ', ', 'author_start' => '', 'author_end' => '', 'read' => '»»»', 'read_start' => '', 'read_end' => '', 'comments_count_start' => '', 'comments_count_end' => '', 'thumb' => true, 'thumb_width' => 320, 'thumb_height' => 180, 'thumb_class' => 'thumb left', 'placehold' => false, 'placehold_path' => 'http://placehold.it/', 'placehold_pattern' => '[W]x[H].png', 'placehold_file' => false, 'placehold_data_bg' => '#CCCCCC', 'block_start' => '', 'block_end' => '', 'line1' => '[thumb]', 'line1_start' => '', 'line1_end' => '', 'line2' => '[title]', 'line2_start' => '', 'line2_end' => '', 'line3' => '[date] [cat]', 'line3_start' => '<p class="home-last-page-info">', 'line3_end' => '</p>', 'line4' => '', 'line4_start' => '', 'line4_end' => '', 'line5' => '', 'line5_start' => '', 'line5_end' => '', 'content' => true, 'content_chars' => 0, 'content_words' => 0, 'content_cut' => ' ...', 'content_start' => '<div class="mso-page-content">', 'content_end' => '</div>', 'columns' => 0, 'columns_class_row' => 'onerow', 'columns_class_cell' => 'col w1-2', 'clearfix' => false, 'page_start' => '', 'page_end' => '', 'pagination_start' => '', 'pagination_end' => '', 'box_grid' => 0, 'box_grid_class' => 'w50', 'box_grid_box_class' => 'table-box', 'exclude_page_add' => true);
     $r = array_merge($default, $r);
     // объединяем
     // $r = array_map('trim', $r);
     $p = new Page_out();
     // шаблонизатор
     // echo $r['block_start'];
     eval(mso_tmpl_prepare($r['block_start'], false));
     // формат записи
     $p->format('title', $r['title_start'], $r['title_end']);
     $p->format('date', $r['date'], $r['date_start'], $r['date_end']);
     $p->format('author', $r['author_start'], $r['author_end']);
     $p->format('cat', $r['cat_sep'], $r['cat_start'], $r['cat_end']);
     $p->format('tag', $r['tag_sep'], $r['tag_start'], $r['tag_end']);
     $p->format('read', $r['read'], $r['read_start'], $r['read_end']);
     $p->format('comments_count', $r['comments_count_start'], $r['comments_count_end']);
     if ($r['exclude_page_add']) {
         $exclude_page_id = mso_get_val('exclude_page_id');
     }
     if ($r['columns']) {
         $my_columns = new Columns($r['columns'], count($this->pages), $r['columns_class_row']);
     }
     if ($r['box_grid']) {
         $p->box_grid($r['box_grid']);
     }
     foreach ($this->pages as $page) {
         $p->load($page);
         // загружаем данные записи
         if ($r['box_grid']) {
             $p->box_grid_cell($r['box_grid_class'], $r['box_grid_box_class']);
         }
         if ($r['columns']) {
             $my_columns->out($r['columns_class_cell']);
         }
         // echo $r['page_start'];
         eval(mso_tmpl_prepare($r['page_start'], false));
         if ($r['thumb']) {
             // плейсхолд
             if ($r['placehold']) {
                 if ($r['placehold_file']) {
                     if ($r['placehold_file'] == 'data') {
                         // сами генерируем плейсхолд
                         // mso_holder($width = 100, $height = 100, $text = true, $background_color = '#CCCCCC', $text_color = '#777777', $font_size = 5)
                         $t_placehold = mso_holder($r['thumb_width'], $r['thumb_height'], false, $r['placehold_data_bg']);
                     } else {
                         $t_placehold = $r['placehold_path'] . $r['placehold_file'];
                     }
                 } else {
                     $t_placehold_pattern = str_replace('[W]', $r['thumb_width'], $r['placehold_pattern']);
                     $t_placehold_pattern = str_replace('[H]', $r['thumb_height'], $t_placehold_pattern);
                     $t_placehold_pattern = str_replace('[RND]', rand(1, 10), $t_placehold_pattern);
                     $t_placehold = $r['placehold_path'] . $t_placehold_pattern;
                 }
             } else {
                 $t_placehold = false;
             }
             if ($thumb = thumb_generate($p->meta_val('image_for_page'), $r['thumb_width'], $r['thumb_height'], $t_placehold)) {
                 $p->thumb = '<a href="' . mso_page_url($p->val('page_slug')) . '" title="' . htmlspecialchars($p->val('page_title')) . '"><img src="' . $thumb . '" class="' . $r['thumb_class'] . '" alt="' . htmlspecialchars($p->val('page_title')) . '"></a>';
             }
         }
         $p->line($r['line1'], $r['line1_start'], $r['line1_end']);
         $p->line($r['line2'], $r['line2_start'], $r['line2_end']);
         $p->line($r['line3'], $r['line3_start'], $r['line3_end']);
         if ($r['content']) {
             if ($r['content_chars']) {
                 $p->content_chars($r['content_chars'], $r['content_cut'], $r['content_start'], $r['content_end']);
                 // текст обрезанный
             } elseif ($r['content_words']) {
                 $p->content_words($r['content_words'], $r['content_cut'], $r['content_start'], $r['content_end']);
                 // текст обрезанный
             } else {
                 $p->content($r['content_start'], $r['content_end']);
             }
         }
         $p->line($r['line4'], $r['line4_start'], $r['line4_end']);
         $p->line($r['line5'], $r['line5_start'], $r['line5_end']);
         if ($r['clearfix']) {
             $p->clearfix();
         }
         // echo $r['page_end'];
         eval(mso_tmpl_prepare($r['page_end'], false));
         if ($r['columns']) {
             $my_columns->next();
         }
         if ($r['box_grid']) {
             $p->box_grid_next();
         }
         // сохраняем id записей, чтобы их исключить из вывода
         if ($r['exclude_page_add']) {
             $exclude_page_id[] = $p->val('page_id');
         }
     }
     if ($r['columns']) {
         $my_columns->close();
     }
     if ($r['box_grid']) {
         $p->box_grid_end();
     }
     if ($r['exclude_page_add']) {
         mso_set_val('exclude_page_id', $exclude_page_id);
     }
     if ($this->param['pagination']) {
         if (mso_hook_present('pagination')) {
             // echo $r['pagination_start'];
             eval(mso_tmpl_prepare($r['pagination_start'], false));
             mso_hook('pagination', $this->pagination);
             // echo $r['pagination_end'];
             eval(mso_tmpl_prepare($r['pagination_end'], false));
         }
     }
     // echo $r['block_end'];
     eval(mso_tmpl_prepare($r['block_end'], false));
 }
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
	info-top файл
	предыдущая - следующая запись
	вывод рубрик перед заголовком записи
*/
// следующая-предыдущая запись
if (is_type('page') and $p->val('page_type_name') == 'blog') {
    $np = mso_next_prev_page(array('page_id' => $p->val('page_id'), 'page_categories' => $p->val('page_categories'), 'page_date_publish' => $p->val('page_date_publish')));
    $np_out = '';
    if ($np['next']) {
        $np_out .= '<div class="d-inline-block left">← ' . $p->link(mso_page_url($np['next']['page_slug']), $np['next']['page_title']) . '</div>';
    }
    if ($np['prev']) {
        $np_out .= '<div class="d-inline-block right">' . $p->link(mso_page_url($np['prev']['page_slug']), $np['prev']['page_title']) . ' →</div>';
    }
    $p->block($np_out, '<div class="next-prev-page">', '</div><div class="clearfix"></div>');
}
$p->format('edit', 'Edit', '<div class="right bg-yellow padding5 d-inline-block">', '</div>');
$p->format('cat', ' / ', '<div>', '</div>');
$p->format('date', 'D, j F Y г.', '<div><time datetime="[page_date_publish_iso]">', '</time></div>');
$p->html(NR . '<header>');
$p->line('[edit][title]');
$p->div_start('info info-top');
$p->line('[cat]');
$p->line('[date]');
$p->div_end('info info-top');
$p->html('</header>');
# end file
예제 #4
0
 function page_url($html_link = false)
 {
     if ($html_link) {
         return '<a href="' . mso_page_url($this->val('page_slug')) . '">';
     } else {
         return mso_page_url($this->val('page_slug'));
     }
 }