Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript"> var theForm = document.forms['tt_dsl_rechner'];
function addHidden(theForm, key, value){
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = value;
theForm.appendChild(input);
}
update TMP_selectoptions t, atselectoptions aso, collectionAttributeValues cav, atSelectOptionsSelected asos
set asos.atSelectOptionID = aso.ID
where t.value_live = aso.value and t.cID = cav.cID and t.cvID = cav.cvID and cav.akID = 15 and cav.akID = aso.akID and cav.avID = asos.avID and t.value_live != t.value;
select distinct b.bid, c.cid, b.content
from btcontentlocal b, collectionversionblocks c, (select cid, max(cvid) as cvid from collectionversionblocks where arhandle = 'content' group by cid) v
where b.bid = c.bid and c.cid = v.cid and c.cvid = v.cvid and c.arhandle = 'content' and instr(b.content, 'href=\"{CCM:CID_');
@roborobs
roborobs / php: display errors
Created February 9, 2013 08:40
php: display errors for debugging
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
@roborobs
roborobs / gist:4723937
Created February 6, 2013 16:50
mysql: update
UPDATE atselectoptionsselected, collectionsearchindexattributes, collectionattributevalues, atselectoptionsselected ,pages
SET atselectoptionsselected.atSelectOptionID = '6'
WHERE
pages.cParentID = '1818' AND
pages.cID = collectionsearchindexattributes.cID AND
pages.cID = collectionattributevalues.cID AND
atselectoptionsselected.avID = collectionattributevalues.avID;
@roborobs
roborobs / mysql: LOOP with condition (something is found)
Created February 5, 2013 10:26
mysql: loop (stops when condition has reached)
DELIMITER $$
CREATE PROCEDURE pages(in _cID int)
BEGIN
declare cID_new int;
declare cvName_new varchar(255);
set cID_new = _cID;
simple_loop: LOOP
select distinct pages.cParentID, collectionversions.cvName
@roborobs
roborobs / mysql: INSERT SELECT
Created February 5, 2013 10:25
mysql: INSERT...SELECT (copy colums / change dependencys)
INSERT INTO ttredirect
cPath, targetCPath)
SELECT
pagepaths.cPath, collectionsearchindexattributes.ak_add_redirect, collectionsearchindexattributes.cID
FROM
pagepaths, collectionsearchindexattributes
WHERE
collectionsearchindexattributes.ak_add_redirect != 0 AND collectionsearchindexattributes.ak_add_redirect iS NOT NULL;
# Update all childpages(1818) attribute(select) values in concrete5
@roborobs
roborobs / gist:4430704
Created January 1, 2013 22:51
html/css: @font-face - add custom font to website
@font-face {
font-family: 'FontAwesome';
src: url('../font/fontawesome-webfont.eot');
src: url('../font/fontawesome-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/fontawesome-webfont.woff') format('woff'),
url('../font/fontawesome-webfont.ttf') format('truetype'),
url('../font/fontawesome-webfont.svg#FontAwesome') format('svg');
font-weight: normal;
font-style: normal;
}
@roborobs
roborobs / htaccess: rewrite examples
Created December 18, 2012 01:22
htaccess: rewrite examples
# RewriteEngine on
# RewriteBase /
# RewriteCond %{HTTP_HOST} ^yourdomain\.de$
# RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
# RewriteRule ^rating/([^/]*)/([^/]*)$ index.php?m=ajax&t=rating&mid=$1&vid=$2&o=ajax [NC,L]
# RewriteRule ^comment/([^/]*)/([^/]*)/([^/]*)$ index.php?m=ajax&t=comment&mid=$1&cid=$2&o=ajax&json=$3 [NC,L]
# RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ index.php?m=model&t=task&text=$2&textid=$3
<IfModule mod_rewrite.c>
RewriteEngine On