Skip to content

Instantly share code, notes, and snippets.

View putzflorian's full-sized avatar

Florian Putz putzflorian

  • @elements-at
  • Salzburg
  • 10:43 (UTC +02:00)
View GitHub Profile
<?php
$page = $this->_getParam("page");
$per_page = 5;
$paginator = Zend_Paginator::factory($events);
$paginator->setCurrentPageNumber($page);
$paginator->setPageRange(5);
$paginator->setItemCountPerPage($per_page);
$this->view->paginator = $paginator;
<?php
$this->getResponse()->setHeader("X-Robots-Tag", "noindex, follow");
$this->getResponse()->setHeader("X-Robots-Tag", "unavailable_after: " . $object->getDate()->get(Zend_Date::RFC_850));
if($object->getDate() instanceof Carbon\Carbon){
$this->getResponse()->setHeader("X-Robots-Tag", "unavailable_after: " . $object->getDate()->toRfc850String());
}
?>
You need jQuery 1.6 and upper.
Facebook:
For the FB reload you also need a Variable called "lang" in js with the language code (de, en, it, fr...)
For more information show comments in the file facebook.js
Google Plus:
You only need jQuery and edit the selector (id,class) where you would like to show g+
@putzflorian
putzflorian / getSafeFilename.php
Created May 21, 2013 08:03
getSafeFilename for assets or objects
<?php
protected function getSafeFilename($targetPath, $filename) {
$originalFilename = $filename;
$count = 1;
if ($targetPath == "/") {
$targetPath = "";
}
@putzflorian
putzflorian / frontendlogin.php
Created May 22, 2013 07:32
pimcore backenduser für frontend verwenden
<?php
if($_COOKIE["pimcore_admin_sid"]) {
$user = Pimcore_Tool_Authentication::authenticateSession();
if($user instanceof User) {
// bist eingeloggt
}
}
<?
$test = array();
$test[0] = array('trest' => 'hallo', 'rime' => 15);
$test[2] = array('trest' => 'hallo', 'rime' => 15);
$test[3] = array('trest' => 'hallo', 'rime' => 2);
$test[4] = array('trest' => 'hallo', 'rime' => 5);
<?
$url = "http://clients.intermaps.com/admin/imgupload/11526_20130131153359_hoehenweg_etappe 6 (11).jpg";
$url = explode('/', $url);
$base = array_pop($url);
$url = implode('/', $url) . '/' . rawurlencode($base);
Pimcore_Tool::getHttpData($url);
@putzflorian
putzflorian / jscompress.php
Created June 18, 2013 15:06
compress js files with php
<?php
$jsFiles = array(....DEINE JS FILES ...);
$failed = array();
$checksum = "";
foreach($jsFiles as $file){
$realPath = PIMCORE_DOCUMENT_ROOT . $file;
if(file_exists($realPath)) {
$checksum .= ($file . "-" . filemtime($realPath) . "~~");
@putzflorian
putzflorian / Jsonzend.php
Created June 18, 2013 15:10
JsonZendHelper
<?php
$this->_helper->json($jsonarray);
?>
@putzflorian
putzflorian / gist:5813545
Created June 19, 2013 11:14
JAVASCRIPT TOOLS
http://mintchaos.github.io/flippant.js/