Skip to content

Instantly share code, notes, and snippets.

@kikmedia
kikmedia / gist:6437784
Created September 4, 2013 14:31
Render POI from a dlh_googlemap module. Simply add *below* the map and set the gmapID. #Contao #dlh_googlemaps
<script type="text/javascript">
function gmap<?php echo this->$mapID; ?>_dynmap(gmap<?php echo this->$mapID; ?>) {
var Styles = [
{
featureType: "poi.business",
stylers: [
{ visibility: "off" }
]
},
@kikmedia
kikmedia / index.php
Last active December 22, 2015 21:49
Nasty little thing creating directories depending on a given news.
<?php
$this->import("Database");
$strDestPath = sprintf('tl_files/news/%s/',$this->Input->get('items'));
// Sicherstellen, das der Pfad existiert
$objPath = new Folder($strDestPath);
$arrFiles = scan(TL_ROOT.'/'.$strDestPath);
$objDummy = $this->Database->prepare("SELECT id FROM tl_log")->limit(1)->execute();
@kikmedia
kikmedia / gist:6547619
Last active December 22, 2015 23:29
Redirect everything to https via .htaccess (just put it in as first rule after mod_rewrite was adressed)
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@kikmedia
kikmedia / gist:6571419
Created September 15, 2013 14:50
Trigger a Scheduler based Contao cronjob from front end. Simply let this drop in via module.
<img src="system/modules/cron/CronImage.php" width="0" height="0" alt="" />
@kikmedia
kikmedia / gist:7131990
Created October 24, 2013 05:50
Creating row-based output
<?php
$count = count($this->data);
// Begin of loop
$i++;
if ($i % 3 == 1)
{
echo '<div class="row">';
@kikmedia
kikmedia / gist:7302818
Last active December 27, 2015 09:19
Rendering elements into an nle_template for every item but the last one.
<tr>
<td valign="top" class="<?php echo $this->class; ?>"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if(strlen($this->headline)):?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif;?>
<div class="eventList">
<?php $count = count($this->events); ?>
<?php foreach($this->events as $event): ?>
<div class="singleEvent">
DELETE FROM mail_info_history
USING mail_info, accounts
WHERE
mail_info_history.hostname_passwd = mail_info.hostname_passwd
AND
mail_info_history.login_name = mail_info.login_name
AND
accounts.hostname_passwd = mail_info.hostname_passwd
AND
accounts.login_name = mail_info.login_name
@kikmedia
kikmedia / localconfig.php
Created November 22, 2013 11:23
Disable the Contao 'An Update is available'-message for non-admin users
foreach ((array) $GLOBALS['TL_HOOKS']['getSystemMessages'] as $k => $arrHook) {
if ($arrHook[1] == 'versionCheck') {
unset($GLOBALS['TL_HOOKS']['getSystemMessages'][$k]);
}
}
@kikmedia
kikmedia / smoothscroll.js
Created December 2, 2013 10:30
Smoothscroll for Contao CMS
<script>
$(document).ready(function(){
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
window.location.hash = target;
@kikmedia
kikmedia / .htacccess
Last active February 9, 2023 03:29
Mobile / desktop redirect via .htaccess, setting cookies
RewriteEngine on
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.example.com]
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$ [OR]