Skip to content

Instantly share code, notes, and snippets.

View stefansl's full-sized avatar

Stefan Schulz-Lauterbach stefansl

View GitHub Profile
@stefansl
stefansl / Reset Subcolums
Last active August 29, 2015 14:07
contao-mediaquery-reset-subcolums.less
# Taken from the module contao-boilerplate
# Author: Andreas Isaak (Thanks for that!)
# https://github.com/andreasisaak/contao-boilerplate
@media only screen and (max-width: 480px) {
#header > .inside,
#main > .inside,
#footer > .inside {
padding: 1em;
@stefansl
stefansl / subcolumns dca
Last active October 13, 2015 06:28
Contao - limit subcolumn sets for user
/* Paste this into your /system/config/dcaconfig.php */
/* Configuration: which types of sets should be in the selectmenu? */
$allowed_gaptypes = array( '25x25x25x25','33x33x33','50x50' );
if (is_array($GLOBALS['TL_SUBCL'])) {
foreach ( $GLOBALS['TL_SUBCL'] as $set_key => $value)
{
foreach ( $GLOBALS['TL_SUBCL'][$set_key]['sets'] as $key => $value)
{
@stefansl
stefansl / contao_og
Last active October 13, 2015 07:38
Contao - opengraph tags in page layout
<meta property="og:image" content="{{env::url}}/files/_theme/images/facebook_preview.png" />
<meta property="og:url" content="{{env::path}}{{env::request}}" />
<meta property="og:site_name" content="{{page::rootTitle}}" />
<meta property="og:title" content="{{page::pageTitle}}" />
<meta property="og:type" content="website" />
@stefansl
stefansl / TL_CONFIG magickimages
Created August 12, 2013 12:23
default settings magickimages for Contao
$GLOBALS['TL_CONFIG']['magickimages_unsharp_mask'] = true;
$GLOBALS['TL_CONFIG']['magickimages_force'] = true;
$GLOBALS['TL_CONFIG']['magickimages_filter'] = 'Hermite';
$GLOBALS['TL_CONFIG']['magickimages_pngrewrite'] = true;
$GLOBALS['TL_CONFIG']['magickimages_optipng'] = false;
$GLOBALS['TL_CONFIG']['magickimages_advpng'] = false;
$GLOBALS['TL_CONFIG']['magickimages_unsharp_mask_radius'] = 0.3;
$GLOBALS['TL_CONFIG']['magickimages_unsharp_mask_sigma'] = 0.9;
$GLOBALS['TL_CONFIG']['magickimages_unsharp_mask_amount'] = 1.1;
$GLOBALS['TL_CONFIG']['magickimages_unsharp_mask_threshold'] = 0.005;
@stefansl
stefansl / langconfig.php
Last active March 4, 2016 14:19
Anrede "Du" in Contao-Formularfeldern
<?php
if (TL_MODE == 'FE') {
if ($GLOBALS['TL_LANGUAGE'] == 'de') {
$GLOBALS['TL_LANG']['SEC']['question1'] = 'Bitte addiere %d und %d.';
$GLOBALS['TL_LANG']['SEC']['question2'] = 'Bitte addiere %d und %d.';
$GLOBALS['TL_LANG']['SEC']['question3'] = 'Bitte rechne %d plus %d.';
$GLOBALS['TL_LANG']['MSC']['confirmation'] = 'Passwort bestätigen';
@stefansl
stefansl / myExportClass.php
Last active October 1, 2016 13:32
Pass Contao filter/search/order settings to your export class
<?php
/**
* Class MyExport
*/
class MyExport
{
/**
* @param \DataContainer $dc
@stefansl
stefansl / backupdb.sh
Last active December 8, 2016 17:34
Quick MySQL-Backup for one database on Linux-Shell
#!/bin/bash
# Database credentials
DBUSER=""
DBPASSWORD=""
DBHOST="localhost"
DBNAME=""
USER="" # fe. myuser.mygroup
# Other options
BACKUP_PATH="./backup"
@media (min-width:20em) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:30.063em) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:40.063em) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:60.063em) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:64.063em) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:80.063em) { /* hi-res laptops and desktops */ }
@stefansl
stefansl / dcaconfig.php
Last active June 15, 2018 17:31
Some personal improvements in Contao (/system/config/dcaconfig.php)
// Reihenfolge der Headline-Typen ändern
$GLOBALS['TL_DCA']['tl_content']['fields']['headline']['options']= array('h2', 'h3', 'h4', 'h5', 'h6', 'h1');
// Artikel und Seiten standardmäßig auf 'veröffentlicht' stellen
$GLOBALS['TL_DCA']['tl_article']['fields']['published']['default'] = true;
$GLOBALS['TL_DCA']['tl_page']['fields']['published']['default'] = true;
// HTML in Überschriften erlauben
$GLOBALS['TL_DCA']['tl_content']['fields']['headline']['eval']['allowHtml'] = true;
@stefansl
stefansl / additem_1.php
Last active February 3, 2019 14:04
Magnalister Hook / Amazon - merge description with open text fields in engine/Shopware/Plugins/Community/Backend/RedMagnalister/Lib/Codepool/10_Customer/Hooks/Hook/additem_1.php
<?php
// Merge Shopware description w/ Attribute 5
if ($sMarketplaceName === 'amazon') {
// $aProduct = MLProduct::factory()->set('id', $iMagnalisterProductsId);
// MLMessage::gi()->addInfo($aAddItemData['Variations'], get_defined_vars());
// MLMessage::gi()->addInfo($aProduct, get_defined_vars());
// MLMessage::gi()->addInfo($iMagnalisterProductsId, get_defined_vars());
foreach ($aAddItemData['Variations'] as $sVariant) {
if ($sVariant['EAN'] === $aAddItemData['EAN']) {