Skip to content

Instantly share code, notes, and snippets.

View putzflorian's full-sized avatar

Florian Putz putzflorian

  • @elements-at
  • Salzburg
  • 11:58 (UTC +02:00)
View GitHub Profile
@putzflorian
putzflorian / Dropdown.php
Created July 4, 2013 09:56
Object_Service Dropdown im Pimcoreobject
<?php
$myselect = Object_Service::getOptionsForSelectField($this->object, "kategorie");
echo $myselect[$this->object->getKategorie()];
?>
@putzflorian
putzflorian / country.php
Last active December 19, 2015 12:29
Countrydropdown preselected list
<?php if($this->editmode){ ?>
<?= $this->translate('Auswahl') ?>:
<?php echo $this->select("mymode",array(
"store" => array(
array("myselect", $this->translate('Länder vorselektierung')),
array("myauswahl", $this->translate('Länder auswählen'))
),"reload" => true
)); ?>
@putzflorian
putzflorian / ElementsHeadMeta.php
Last active December 19, 2015 14:59
SEO Meta Helper
<?php
class Website_View_Helper_ElementsHeadMeta extends Zend_View_Helper_Placeholder_Container_Standalone
{
private $built;
public function elementsHeadMeta()
{
return $this;
}
@putzflorian
putzflorian / PimcoreCDN.php
Created July 18, 2013 18:43
CDN support for Pimcore
<?php
public function preDispatch() {
$cdn = new Pimcore_Controller_Plugin_CDN();
$cdn->setCdnhostnames(array('http://cloudfront.net'));
$cdn->setCdnpatterns(array('/^\/website/', '/^\/static/'));
Zend_Controller_Front::getInstance()->registerPlugin($cdn);
}
?>
@putzflorian
putzflorian / Apache_Semaphores.sh
Last active December 20, 2015 08:39
Apache Semaphores => lässt sich nicht mehr starten
for i in `ipcs -s | awk '/www-data/ {print $2}'`; do (ipcrm -s $i); done
killall -9 apache2
@putzflorian
putzflorian / Object.keys.js
Created August 19, 2013 11:40
Object.keys for IE8
Object.keys = Object.keys || (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"),
DontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
@putzflorian
putzflorian / facebookresize.js
Created October 28, 2013 10:49
Facebook IFRAME AutoResize
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'XXX-XXXX', //Your facebook APP here
cookie : true // enable cookies to allow the server to access the session
});
}
window.onload = function() {
@putzflorian
putzflorian / Zend_View_Helper.php
Last active February 10, 2017 19:08
Zend_View_Helper
<?php
$this->getRequest()->getPost('id', null);
$this->headScript()->appendFile('/static/js/parsley.js','text/javascript');
$this->headLink()->appendStylesheet('/static/css/themenuebersicht.css');
// get snippet path
$this->snippet("xyz")->getSnippet()->getFullPath()
<ol class="breadcrumb">
<?php
$breadcrumbNavigation = $this->pimcoreNavigation()->getNavigation($this->document, Document::getByPath('/' . $this->language));
echo $this->navigation()->breadcrumbs()->setUseTranslator(false)->setMinDepth(null)->renderPartial($breadcrumbNavigation, "/navigation/partials/breadcrumb.php");
?>
</ol>
@putzflorian
putzflorian / siteredirect.php
Last active August 29, 2015 13:56
redirect Pimcore Site Request
<?php
// redirect site
if(!Pimcore_Tool::isFrontentRequestByAdmin()){
$d = preg_match('/region\/(.*)/', $this->_request->getPathInfo(), $matches);
if($d){
$this->redirect('http://www.newdomain.at/' . $matches[1], array('code' => 301));
}
}