Skip to content

Instantly share code, notes, and snippets.

@texnixe
texnixe / test.html
Last active January 29, 2020 18:53
<h1>This is the title</h1>
Some text here
@texnixe
texnixe / index.php
Created June 12, 2019 12:03
Imagetag override test
<?php
Kirby::plugin('texnixe/imagetagtest', [
'tags' => [
'image' => [
'attr' => [
'alt',
'caption',
'class',
'height',
@texnixe
texnixe / nginx
Created July 4, 2018 12:17 — forked from bastianallgeier/nginx
nginx setup
# block content
location ~ ^/content/(.*).(txt|md|mdown)$ {
rewrite ^/content/(.*).(txt|md|mdown)$ /error redirect;
}
# block all files in the site folder from being accessed directly
location ~ ^/site/(.*)$ {
rewrite ^/site/(.*)$ /error redirect;
}
@texnixe
texnixe / assets_css_editor.css
Created June 28, 2018 09:41 — forked from fabianmichael/assets_css_editor.css
Simple Inline Editor for Kirby
input[type="text"],
textarea {
-webkit-appearance: none;
border: 0;
border-radius: 0;
font: inherit;
line-height: inherit;
resize: none;
width: 100%;
padding: 0;
@texnixe
texnixe / indexer.php
Created March 13, 2018 17:47 — forked from sebsel/indexer.php
Indexer for Kirby
<?php
class Indexer {
static $fields;
static $methods;
static $site;
static function get($where = null, $num = 20, $hideDeleted = true) {
if (!static::$site) static::$site = site();
@texnixe
texnixe / methods.php
Last active August 14, 2023 06:04
Collection of custom Kirby page, pages, field etc. methods
<?php
// page methods
// check if page has Parents
page::$methods['hasParents'] = function($page) {
return $page->parents()->count();
};
// get max nesting level of page
@texnixe
texnixe / filterbystructure.php
Last active June 15, 2017 12:25
Kirby custom pages method to filter by values in structure field
<?php
/* Usage example:
* $filteredPages = $page('projects')->children()->visible()->filterByStructure('structureField', array(
* 'field1' => $value,
* 'field2' => $value
* ));
*/
pages::$methods['filterByStructure'] = function($pages, $field, $options) {
$filteredPages = $pages->filter(function($p)use($field, $options) {
$structureField = $p->$field()->yaml();

Keybase proof

I hereby claim:

  • I am texnixe on github.
  • I am sonjabroda (https://keybase.io/sonjabroda) on keybase.
  • I have a public key whose fingerprint is C827 C112 15AF AC65 CC19 2D8A 5078 A576 776F E582

To claim this, I am signing this object:

@texnixe
texnixe / gist:390996ca722fbf49c63d
Last active August 29, 2015 14:08
tag-results.php
<?php
snippet('header');
$tag = urldecode(param('tag'));
if(param('tag'))
$articles=$pages->visible()->filterBy('tags',$tag,',')->sortBy('date')->flip();
?>
<main class="main">
<section>
<h1><?php echo $page->title() . ' ' . $tag ?></h1>
<?php
/**
* Move this file to /site/snippets/ and rename it video.php
*/
// stop without videos
if(empty($videos)) return;
// set some defaults