Skip to content

Instantly share code, notes, and snippets.

View bueckl's full-sized avatar

Jochen Gülden bueckl

View GitHub Profile
@bueckl
bueckl / gist:db41a070dc2404403688
Created June 23, 2015 21:52
#SS3 adding original Content below formfields on Translated DOs
$ContentFutter1 = new HTMLEditorField('ContentFutter1', 'Spalte 1');
$ContentFutter2 = new HTMLEditorField('ContentFutter2', 'Spalte 2');
$ContentFutter3 = new HTMLEditorField('ContentFutter3', 'Spalte 3');
// transform the fields if we're not in the default locale
if(Translatable::default_locale() != Translatable::get_current_locale()) {
$translation = $this->getTranslation(Translatable::default_locale());
$transformation = new Translatable_Transformation($translation);
$ContentFutter1 = $transformation->transformFormField($ContentFutter1);
$ContentFutter2 = $transformation->transformFormField($ContentFutter2);
@bueckl
bueckl / gist:c56f5380e81c9fa7d56e
Created June 24, 2015 13:53
Hide Browser URL Bar
<!-- Make it fullscreen / hide the browser URL bar -->
<meta name="apple-mobile-web-app-capable" content="yes" />
@bueckl
bueckl / wget
Last active October 11, 2023 08:05
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@bueckl
bueckl / Multi Column Nav Example #SS3, #Silverstripe 3
Last active August 29, 2015 14:25
Multi Column Nav Example #SS3, #Silverstripe 3
/* On Controller …
This method splits the nav in rows of 3
*/
public function getCustomMenu($level = 1) {
@bueckl
bueckl / HTMLGridfield.php
Created August 17, 2015 16:06
HTML in Gridfield
function getColourNice(){
$obj= HTMLText::create();
$obj->setValue('<div style="background-color: '.$this->Colour.'; width: 100px; height: 100px;">&nbsp;</div>');
return $obj;
}
@bueckl
bueckl / using an action to render a SiteTree object
Created August 30, 2015 18:47
#SilverStripe - 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();
@bueckl
bueckl / second-bootstrap-modal.js
Created September 8, 2015 22:27
Open second bootstrap modal
$('#TermsModal').on('shown.bs.modal', function () {
$('#MyModal').css('z-index', 1040);
});
$('#TermsModal').on('hidden.bs.modal', function () {
$('#MyModal').css('z-index', 1050);
});
@bueckl
bueckl / JSON2Template
Created December 11, 2015 10:33
#Silverstripe Convert JSON Data to ArrayData for Template
//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 / i18n.yml
Created January 5, 2016 14:39
Order Translations YML #SilverStripe
---
Name: customi18n
Before: 'defaulti18n'
---
i18n:
module_priority:
- mysite
- othermodule
@bueckl
bueckl / Social.ss
Created April 4, 2016 08:36
Social Icons Example including OpenGraph Meta Data etc, #SS3 #FontAwesome
<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')" />