Skip to content

Instantly share code, notes, and snippets.


Fritz Michael Gschwantner fritzmg

View GitHub Profile

Contao News Sync

Contao extension to automatically synchronize news entries between different installations.


Install the extension on all Contao installations involved in the news synchronisation. After installation, you will see additional options in your Contao news archives under Synchronisation. In order to enable a news archive to be a source for the synchronisation, simply activate the Source for synchronisation option.

Then, on the target news archive, enable the Target for synchronisation option. You will then see additional options. Under Source URL fill in the URL to the Contao installation, from which you want to fetch news entries. Then save the news archive. After saving you will see the available news archives from the remote Contao installation under News archives. Enable the remote news archives from which you want to fetch news entries, then save again.

fritzmg / git-context-global.reg
Created Feb 24, 2019
Windows scoop git global context menu
View git-context-global.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open Git Bash]
@="Open Git Bash"
[HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command]
@="\"C:\\ProgramData\\scoop\\apps\\git\\current\\git-bash.exe\" \"--cd=%1\""
; This will make it appear when you right click ON a folder
fritzmg / MySurcharge.php
Created Jan 15, 2019
Custom Contao Isotope Surcharge
View MySurcharge.php
use Isotope\Model\ProductCollection;
class MySurcharge
public function findSurchargesForCollection(ProductCollection $collection): array
return [\MySurchargeModel::build()];
fritzmg /
Last active Jan 2, 2018
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.
fritzmg /
Created Mar 27, 2016
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 /
Last active Aug 16, 2019
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 / be_rebuild_index.html5
Last active Aug 23, 2016
Contao RebuildIndex template with more feedback
View be_rebuild_index.html5
<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>
<?php endif; ?>
fritzmg / nav_newscategories.html5
Created Nov 26, 2015
nav_newscategories template for the Contao news_categories extension which also takes the jumpTo page into account
View nav_newscategories.html5
<ul class="<?php echo $this->level; ?>">
<?php foreach ($this->items as $item): ?>
// build link to jumpTo page
if( $item['jumpTo'] )
$objJump = \PageModel::findByPk( $item['jumpTo'] );
if( $objJump !== null )
fritzmg / j_tablesort.html5
Created Nov 21, 2015
j_tablesort template which includes the default sort option provided by Contao
View j_tablesort.html5
// 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=""></script>
fritzmg / isotope_cart_ajax.js
Last active Aug 27, 2015
Contao Isotope cart AJAX actions
View isotope_cart_ajax.js
// or use 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;