This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$_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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class YachtAdmin extends ModelAdmin { | |
private static $managed_models = array( | |
'Yacht' | |
); | |
public function getSearchContext(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getCMSFields() { | |
$fields = parent::getCMSFields(); | |
$MainTab = $fields->findOrMakeTab( | |
"Root.Main" | |
); | |
$MainTab->setTitle('NEW TITLE'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Name: customi18n | |
Before: 'defaulti18n' | |
--- | |
i18n: | |
module_priority: | |
- mysite | |
- othermodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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" | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#TermsModal').on('shown.bs.modal', function () { | |
$('#MyModal').css('z-index', 1040); | |
}); | |
$('#TermsModal').on('hidden.bs.modal', function () { | |
$('#MyModal').css('z-index', 1050); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
NewerOlder