Skip to content

Instantly share code, notes, and snippets.

Helper Sheet for Contao
PHP Binary
Netcup: /usr/local/php74/bin/php -v
Hetzner: /usr/bin/php80 -v
Create a Contao installation:
/usr/local/php74/bin/php -d memory_limit=-1 -d max_execution_time=900 composer.phar create-project contao/managed-edition example 4.12
Load Contao Manager File into /web/ bzw. /public/
@hh-com
hh-com / Browser-Sync und Contao (Windows)
Last active September 26, 2019 20:56
Browser-Sync und Contao (Windows)
1) Contao lokal installieren (WAMP)
2) vhost lokal einrichten und Windows Hosts-File
3) CMD (admin) npm installieren
4) CMD (admin) BrowserSync für das jeweilige Projekt installieren: npm install -i browser-sync
5) BrowserSync starten: browser-sync start --proxy vbeat:8080 --files **/*, !vendor/**, !/.history/**, !var/** --no-notify (proxy == vhost)
6) Verzeichniss ausschließen mit !
7) Fehlermeldung wenn zu viele Files watched werden.
INFO: Die externe IP kann falsch sein, dazu einfach mit ipconfig die IP des Systems suchen und diese mit dem Port auf externen Geräten eintragen
https://www.youtube.com/watch?v=Bxhr6OmNOJE
@hh-com
hh-com / StreamBuffer.php
Last active March 27, 2019 20:26
Workaround for Swiftmailer Easyname - Problem
// /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
private function _establishSocketConnection()
{
$host = $this->_params['host'];
if (!empty($this->_params['protocol'])) {
$host = $this->_params['protocol'].'://'.$host;
}
$timeout = 15;
if (!empty($this->_params['timeout'])) {
@hh-com
hh-com / readmore.js
Created December 17, 2018 23:35
Readmore.js for jQuery 3.*
/*!
* @preserve
*
* Readmore.js jQuery plugin
* Author: @jed_foster
* Project home: http://jedfoster.github.io/Readmore.js
* Licensed under the MIT license
*
*##############
*https://github.com/jedfoster/Readmore.js/issues/183
@hh-com
hh-com / generateUniqueKey.php
Last active December 13, 2018 21:51
Contao - Create a Unique Key by a char set
<?php
public static function generateUniqueId()
{
$charSet = "ABCDEFGHJKLMNPQRSTUVWXYZ123456789";
$position = 0;
$uniqueId = '';
for ($i = 0; $i < 6; $i++)
{
public static function generateUniqueId()
{
# Zeichenvorrat
$zeichenvorrat = self::$zeichenvorrat;
$position = 0;
$uniqueId = '';
for ($i = 0; $i < 6; $i++)
{
$position = ($position + rand(1000, 9999)) % strlen($zeichenvorrat);
@hh-com
hh-com / Cron_Contao4_Run_File_Without_Module.php
Created December 13, 2018 19:39
Boilerplate: Contao4- Run Singlefile without Module (by Cron)
<?php
/**
**/
define('TL_MODE', 'FE');
define('BYPASS_TOKEN_CHECK', true);
/*Cache-Control:*/
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
header("Pragma: no-cache"); //HTTP 1.0
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
@hh-com
hh-com / contao-hello-world-bundle-tutorial.md
Created October 24, 2018 22:13
Contao Hello World Bundle Tutorial

Contao Hello World Bundle Tutorial

Möchte man eine Contao Erweiterung in mehreren Projekten einsetzen und/oder der Allgemeinheit zur Verfügung stellen, legt man dazu am besten ein Bundle an und veröffentlicht es auf Packagist. Dann lässt sich die Erweiterung einfach über Composer oder den Contao Manager installieren. Dieses Tutorial beschreibt wie das unter Verwendung des Skeleton Bundles funktioniert. Dabei wird ein Bundle erstellt, das ein Inhaltselement erzeugt, das "Hello World" ausgibt. Folgendes werden wir machen.

  1. Einen Vendor- und Bundle-Namen wählen
  2. Das Skeleton Bundle verstehen und anpassen
  3. Ein Repository für das Bundle anlegen
  4. Das Bundle in der Entwicklungsinstallation installieren
  5. Die grundlegende Funktionalität implementieren
  6. Unit Tests schreiben
@hh-com
hh-com / Cron_Contao3_Run_File_Without_Module.php
Last active December 13, 2018 19:34
Boilerplate: Contao3- Run Singlefile without Module (by Cron)
<?php
/**
######### Dont forget to create a .htaccess in the same direcotry from this file ###########
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
@hh-com
hh-com / Cron_Prestashop_Run_File_Without_Module.php
Last active November 28, 2019 14:08
Boilerplate: Prestashop - Run Singlefile without Module
<?php
/**
* NOTICE OF LICENSE
*
* Copyright Harald Huber
* You are allowerd to use this module in one project (also commercial).
* You are not allowed to share or sell this software.
*
* DISCLAIMER
*