Skip to content

Instantly share code, notes, and snippets.

View bastianallgeier's full-sized avatar
🎯
Focusing

Bastian Allgeier bastianallgeier

🎯
Focusing
View GitHub Profile
@bastianallgeier
bastianallgeier / radius.php
Last active April 19, 2020 18:09
Radius search
<?php
/**
* Simple helper to fetch the bounding boxes
* for a point on the map (lat,lng) by radius.
*
* @param double $lat Latitude
* @param double $lng Longitude
* @param int $radius Radius in km
* @return array
@bastianallgeier
bastianallgeier / mywidget.php
Created March 9, 2015 10:54
Most basic widget setup for panel widgets. You would put those two files in /site/widgets/mywidget/
<?php
return array(
'title' => 'Widget Title',
'html' => function() {
// any data for the template
$data = array();
return tpl::load(__DIR__ . DS . 'template.php', $data);
}
);
@bastianallgeier
bastianallgeier / drop.html
Last active August 29, 2015 14:16
dropload
<div class="drop">Drop it like it's hot.</div>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="build/jquery.dropload.min.js"></script>
<script>
$('.drop').drop({
dragover: function() {
$(this).addClass('over');
},
<?php $thumb = thumb($cover, array('width' => 300)) ?>
<img src="<?php echo $thumb->url() ?>" width="<?php echo $thumb->width() ?>" width="<?php echo $thumb->height() ?>" alt="">
<?php if ($mainimg = $post->image((string)$post->mainimage())): ?>
<img class="mainImg" src="<?php echo thumb($mainimg, array('width' => 300))->url(); ?>" alt="">
<?php endif ?>
<?php if($imagename = param('bild') and $image = $page->image($imagename)): ?>
<!-- put the image template code here -->
<?php else: ?>
<!-- show the regular template here -->
<?php endif ?>
@bastianallgeier
bastianallgeier / config.php
Created January 26, 2015 14:38
Thumbnail destinations with page structure
<?php
c::set('thumbs.destination', function($thumb) {
$page = $thumb->source->page();
$filename = $thumb->source->name() . '-' . $thumb->settingsIdentifier() . '.' . $thumb->source->extension();
$root = $thumb->options['root'] . DS . str_replace('/', DS, $page->uri()) . DS . $filename;
$url = $thumb->options['url'] . '/' . $page->uri() . '/' . $filename;
// create the directory
<?php
// /ldap/ldap.php
class Page extends PageAbstract {}
class Pages extends PagesAbstract {}
class Children extends ChildrenAbstract {}
class Content extends ContentAbstract {}
class Field extends FieldAbstract {}
class File extends FileAbstract {}
# content pipeline
RewriteRule ^content/(.*) content.php
git submodule add https://github.com/getkirby/kirby.git
git submodule add https://github.com/getkirby/panel.git
git submodule update --init --recursive