Skip to content

Instantly share code, notes, and snippets.

View fritzmg's full-sized avatar

Fritz Michael Gschwantner fritzmg

View GitHub Profile
@fritzmg
fritzmg / nav_switch.html5
Created July 13, 2015 10:26
Contao nav_default Template, which allows you to switch to the same subpage within a different "category". Simply create a new custom navigation module, select the pages that act as "category roots" and assign this template. You also need to use folder URLs and the page aliases must be the same (except for the first part, i.e. the "category").
<?php global $objPage; ?>
<ul class="<?= $this->level ?>" role="<?= ($this->level == 'level_1') ? 'menubar' : 'menu' ?>">
<?php foreach ($this->items as $item): ?>
<?php
// get the current page's alias and remove its first part
$arrAlias = explode('/', $objPage->alias);
array_shift($arrAlias);
@fritzmg
fritzmg / filetags.php
Created July 9, 2015 07:51
Replaces file paths like "files/lorem/ipsum/foo.jpg" in Contao text elements with {{file::…}} insert tags.
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @license LGPL-3.0+
*/
@fritzmg
fritzmg / isotope_cart_ajax.js
Last active August 27, 2015 15:39
Contao Isotope cart AJAX actions
(function($)
{
// or use https://github.com/fczbkk/css-selector-generator instead
$.fn.getPath = function () {
if (this.length != 1) throw 'Requires one element.';
var path, node = this;
while (node.length) {
var realNode = node[0], name = realNode.localName;
if (!name) break;