Esempio n. 1
0
/**
 * getCoverImage()
 *
 * Returns an img-element with the coverimage for a given post if exists.
 *
 * @param  mixed $post
 * @return string
 */
function getCoverImage($post)
{
    $coverimage = (string) $post->coverimage();
    if ($coverimage != "") {
        $img = brick('img');
        $img->attr('src', $post->image($coverimage)->url());
        $img->attr('alt', $post->title()->html());
        return $img;
    }
}
 public function content()
 {
     $calendarBoard = brick('div');
     $calendarBoard->attr('id', 'calendarboard');
     $calendarBoard->data("name", $this->name);
     $calendarBoard->data("month", date("m"));
     $calendarBoard->data("year", date("Y"));
     $calendarBoard->data("field", "createCalendar");
     return $calendarBoard;
 }
Esempio n. 3
0
 public function thumb_img($as = false)
 {
     $thumb_img = $this->files()->find($this->thumb());
     if ($thumb_img) {
         $url = $thumb_img->url();
         $img = brick('img')->attr('src', $thumb_img->url())->addClass('story__thumb');
         return !$as ? $url : $img;
     }
     return false;
 }
/**
 * getCoverImage()
 *
 * Returns an img-element with the coverimage for a given post if exists.
 *
 * @param  mixed $post
 * @return string
 */
function getCoverImage($post, $attr = '')
{
    $coverimage = (string) $post->coverimage();
    if ($coverimage != "") {
        $img = brick('img');
        $img->attr('src', $post->image($coverimage)->url());
        $img->attr('alt', $post->title()->html());
        if (!empty($attr)) {
            foreach ($attr as $k => $v) {
                $img->attr($k, $v);
            }
        }
        return $img;
    }
}
Esempio n. 5
0
<?php

kirbytext::$post[] = function ($kirbytext, $value) {
    return preg_replace_callback('!\\(toc\\)!', function ($match) use($value) {
        preg_match_all('!<h2>(.*)</h2>!', $value, $matches);
        $ul = brick('ul');
        $ul->addClass('toc');
        foreach ($matches[1] as $match) {
            $li = brick('li', '<a href="#' . str::slug($match) . '">' . $match . '</a>');
            $ul->append($li);
        }
        return $ul;
    }, $value);
};
Esempio n. 6
0
<?php 
if ($img = $page->file($section->img())) {
    ?>

<div class="struct-section struct-section--image  struct-section--image--<?php 
    echo $section->display_as();
    ?>
">
	<?php 
    echo brick('img', $attr = array("data-original" => $img->url(), "width" => $img->width(), "height" => 'auto'));
    ?>
	<!-- <img data-original="<?php 
    echo $img->url();
    ?>
"> -->
</div>

<?php 
}