Skip to content

Instantly share code, notes, and snippets.

@andreasisaak
andreasisaak / gist:349086
Created March 30, 2010 13:20
Firebug Dom Elements
The number of DOM elements is easy to test, just type in Firebug's console:
document.getElementsByTagName('*').length
@andreasisaak
andreasisaak / .htaccess
Created April 7, 2010 21:21
If Condition mod_expires
# If Condition mod_expires
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 days"
<FilesMatch "\.(ico|jpg|jpeg|png|gif)$">
ExpiresDefault "access plus 10 days"
</FilesMatch>
<FilesMatch "\.(pdf|flv|swf|js|css)$">
ExpiresDefault "modification plus 10 days"
@andreasisaak
andreasisaak / gist:396427
Created May 10, 2010 19:37
Anzeige einer Grafik in bestimmten TL Archiven
// Anzeige einer Grafik in bestimmten TL Archiven
<?php if ($this->archive == 'Name des Archivs') { ?>
<img class="secure" src="{{env::path}}tl_files/standard/layout/images/secure-news.png" alt="" width="155" height="75" />
<?php } ?>
// prevent click
$('nav').addEvent('click', function(event){
event.stop();
});
@andreasisaak
andreasisaak / gist:5020632
Created February 23, 2013 17:46
No need to replace "domain.com" with this improvement https://github.com/contao/core/pull/4555
## Uncomment to rewrite domain.com to www.domain.com
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
## Uncomment to rewrite www.domain.com to domain.com
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
@andreasisaak
andreasisaak / gist:5712103
Last active December 18, 2015 02:39 — forked from tim-bec/gist:5711780
<?php
#Vorbereiten
$longtext = MetaModelFactory::byTableName('mm_projects')->findById($arrItem['raw']['project']['id'])->get('introduction');
# Longtext an string übergeben
echo String::getInstance()->substr($longtext['value'], 120);
?>
.logo {
width: 204px;
height: 100px;
background: url('/img/logo.png');
}
@media
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
@andreasisaak
andreasisaak / gist:7084979
Created October 21, 2013 14:40
Use retina images in template files
<?php $objInput = Input::getInstance(); ?>
<?php $objCookie = json_decode($objInput->cookie("retina")); ?>
<?php echo ($objCookie->hasRetina) ? $this->getImage('src', 'retina_width', 'retina_height') : $this->getImage('src', 'width', 'height'); ?>
@andreasisaak
andreasisaak / gist:7085018
Created October 21, 2013 14:41
Use contao functions to trim text
<?php
echo '<p class="teaser">' . String::getInstance()->substr($this->text, 80) . '</p>';
?>
/**
* Powered by parallax - The ultimative parallax script for Contao
*
* Copyright ©2012-2013 by MEN AT WORK <info@men-at-work.de>
* Visit the agency website at http://www.men-at-work.de for more information
*
* @package ParallaxXtend
* @copyright MEN AT WORK
* @link http://www.contao-parallax.com
* @license EULA