Skip to content

Instantly share code, notes, and snippets.

View fritzmg's full-sized avatar

Fritz Michael Gschwantner fritzmg

View GitHub Profile
@fritzmg
fritzmg / www_klack_de.xml
Last active December 23, 2015 12:40
UPDATE: Use http://pastebin.com/dd45TDZY instead || MediaPortal WebEPG grabber file for klack.de
<?xml version="1.0" encoding="utf-8"?>
<Grabber>
<Info language="de" availableDays="14" timezone="W. Europe Standard Time" version="2.1.0" />
<Channels>
<Channel id="13TH STREET Universal" siteId="112" />
<Channel id="3sat" siteId="1" />
<Channel id="Animal Planet" siteId="73" />
<Channel id="Animax" siteId="171" />
<Channel id="ANIXE HD" siteId="4" />
<Channel id="ARTE" siteId="6" />
@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 / 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 / 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;
@fritzmg
fritzmg / j_tablesort.html5
Created November 21, 2015 15:27
j_tablesort template which includes the default sort option provided by Contao
<?php
// Add the tablesorter style sheet
$GLOBALS['TL_CSS'][] = 'assets/jquery/tablesorter/' . $GLOBALS['TL_ASSETS']['TABLESORTER'] . '/css/tablesorter.css|static';
?>
<script src="<?= TL_ASSETS_URL ?>assets/jquery/tablesorter/<?= $GLOBALS['TL_ASSETS']['TABLESORTER'] ?>/js/tablesorter.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.0.4/js.cookie.min.js"></script>
<script>
@fritzmg
fritzmg / nav_newscategories.html5
Created November 26, 2015 14:26
nav_newscategories template for the Contao news_categories extension which also takes the jumpTo page into account
<ul class="<?php echo $this->level; ?>">
<?php foreach ($this->items as $item): ?>
<?php
// build link to jumpTo page
if( $item['jumpTo'] )
{
$objJump = \PageModel::findByPk( $item['jumpTo'] );
if( $objJump !== null )
@fritzmg
fritzmg / be_rebuild_index.html5
Last active August 23, 2016 11:32
Contao RebuildIndex template with more feedback
<div id="tl_maintenance_index" class="maintenance_<?= $this->isActive ? 'active' : 'inactive' ?>">
<h2 class="sub_headline_index"><?= $this->indexHeadline ?></h2>
<?php if ($this->indexMessage): ?>
<div class="tl_message">
<p class="tl_error"><?= $this->indexMessage ?></p>
</div>
<?php endif; ?>
@fritzmg
fritzmg / contao-fineuploader-for-news.md
Last active August 16, 2019 11:27
Use fineuploader for news teaser images in Contao

Use fineuploader for news teaser images in Contao

Using these instructions you can replace the default file selector for news teaser images with a direct upload button. This upload button is implemented using the terminal42/contao-fineuploader extension.

First install the extension via the Composer package management for Contao (Packagist: terminal42/contao-fineuploader). Then insert the following content into contao/dca/tl_news.php:

$GLOBALS['TL_DCA']['tl_news']['fields']['singleSRC']['inputType'] = 'fineUploader';
$GLOBALS['TL_DCA']['tl_news']['fields']['singleSRC']['eval'] = [
 'storeFile' =&gt; true, 
@fritzmg
fritzmg / composer-switch-back.md
Created March 27, 2016 10:42
How to cleanly switch from composer back to the old ER2 in Contao

How to cleanly switch from composer back to the old ER2 in Contao

The information given here in the German Contao Wiki can lead to problems. If you want to cleanly switch back to the old ER2 in Contao, you need to follow these steps. But before doing so, you should note down all the extensions that you still need after switching back and you should make sure that these extensions are available in the ER2 and still compatible with your Contao version.

  1. remove all modules and assets from installed extensions (see below)
  2. go to System » Settings » Inactive extensions, check [!composer] and uncheck [repository]
  3. reinstall all needed extensions via the extension repository
  4. once you are sure that everything is working as expected, you can delete the folder /composer and /system/modules/!composer
@fritzmg
fritzmg / contao-event-pagination.md
Last active January 2, 2018 10:27
Previous and next events in the event_full template of Contao.

Contao Event Pagination

This event_full template creates a previous and next pagination for events. It uses the same HTML structure as the default pagination template. Of course you can change that to your needs. Simply download the event_full.html5 template and put it in your /templates directory.

Known limitations:

  • It ignores the start and end field.
  • It is limited to events from the same calendar. Otherwise the target URL might be wrong.
  • It will not work if the auto_item parameter is disabled.