Skip to content

Instantly share code, notes, and snippets.

Jochen Gülden bueckl

Block or report user

Report or block bueckl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ServerVars.php
$_SERVER["DOCUMENT_ROOT"] === /home/user/public_html
$_SERVER["SERVER_ADDR"] === 143.34.112.23
$_SERVER['HTTP_HOST'] === example.com (or with WWW)
$_SERVER["REQUEST_URI"] === /folder1/folder2/yourfile.php?var=blabla
__FILE__ === /home/user/public_html/folder1/folder2/yourfile.php
basename(__FILE__) === yourfile.php
__DIR__ === /home/user/public_html/folder1/folder2 [same: dirname(__FILE__)]
$_SERVER["QUERY_STRING"] === var=blabla
$_SERVER["REQUEST_URI"] === /folder1/folder2/yourfile.php?var=blabla
@bueckl
bueckl / SearchContext.php
Last active Feb 5, 2017
ModelAdmin Custom Search #SearchContext #Search on has_many Relation #SS3 #Silverstripe
View SearchContext.php
<?php
class YachtAdmin extends ModelAdmin {
private static $managed_models = array(
'Yacht'
);
public function getSearchContext(){
@bueckl
bueckl / RenameTab.php
Created Feb 5, 2017
Rename Tab SS3 #Sivlerstripe
View RenameTab.php
public function getCMSFields() {
$fields = parent::getCMSFields();
$MainTab = $fields->findOrMakeTab(
"Root.Main"
);
$MainTab->setTitle('NEW TITLE');
@bueckl
bueckl / scrollcheck.js
Created Jul 26, 2016
Scroll Check -> Scroll Out/In Nav on mobile Devices
View scrollcheck.js
add to app.js on very top:
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
@bueckl
bueckl / dropdown.js
Last active Jun 13, 2016
Make Dropdown Menu work on Touch devices
View dropdown.js
function isTouchDevice() {
return 'ontouchstart' in document.documentElement;
}
// Hack to make dropdown menu work on touch devices
var el = $('#main-nav ul.nav > li.dropdown-large a.dropdown-toggle');
/* If mobile browser, prevent click on parent nav item from redirecting to URL */
@bueckl
bueckl / Social.ss
Created Apr 4, 2016
Social Icons Example including OpenGraph Meta Data etc, #SS3 #FontAwesome
View Social.ss
<div class="social-icons well">
<meta property="og:title" content="$Item.T('OpenImmoObjekttitel')" />
<meta property="og:type" content="website" />
<meta property="og:url" content="$Item.CanonicalLinkURL" />
<meta property="og:image" content="$Item.ImmoImages.First.Image.CroppedWatermarkedImage(470,246).AbsoluteURL" />
<meta property="og:site_name" content="mallorca-immobilien-guide.de" />
<meta property="og:description" content="$Item.T('OpenImmoObjektbeschreibung')" />
@bueckl
bueckl / i18n.yml
Created Jan 5, 2016
Order Translations YML #SilverStripe
View i18n.yml
---
Name: customi18n
Before: 'defaulti18n'
---
i18n:
module_priority:
- mysite
- othermodule
@bueckl
bueckl / JSON2Template
Created Dec 11, 2015
#Silverstripe Convert JSON Data to ArrayData for Template
View JSON2Template
//http://stackoverflow.com/questions/19888110/silverstripe-convert-twitter-json-string-to-dataobject-to-loop-though-in-templa
public static function getTwitterFeed(){
$settings = array(
'oauth_access_token' => "xxx",
'oauth_access_token_secret' => "xxx",
'consumer_key' => "xxx",
'consumer_secret' => "xxx"
);
@bueckl
bueckl / second-bootstrap-modal.js
Created Sep 8, 2015
Open second bootstrap modal
View second-bootstrap-modal.js
$('#TermsModal').on('shown.bs.modal', function () {
$('#MyModal').css('z-index', 1040);
});
$('#TermsModal').on('hidden.bs.modal', function () {
$('#MyModal').css('z-index', 1050);
});
@bueckl
bueckl / using an action to render a SiteTree object
Created Aug 30, 2015
#SilverStripe - Using an action to render a SiteTree object
View using an action to render a SiteTree object
public function show(SS_HTTPRequest $request) {
$page = DataObject::get_by_id('SiteTree', $this->URLParams['ID'] );
if(!$page) {
return $this->httpError(404,'That page could not be found');
}
$controller = new ObjektPage_Controller($page);
$controller->init();
You can’t perform that action at this time.