Skip to content

Instantly share code, notes, and snippets.

View benjaminrau's full-sized avatar

Benjamin Rau benjaminrau

View GitHub Profile
@benjaminrau
benjaminrau / gist:a8ee34c6e0a2eeadb9ba
Last active August 29, 2015 14:05
Load Typoscript in TYPO3 6.2 Userfunctions or Backend
protected function loadTypoScript($extKey) {
list($page) = BackendUtility::getRecordsByField('pages', 'pid', 0);
$pageUid = intval($page['uid']);
$sysPageObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$rootLine = $sysPageObj->getRootLine($pageUid);
$TSObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
$TSObj->tt_track = 0;
$TSObj->init();
$TSObj->runThroughTemplates($rootLine);
$TSObj->generateConfig();
@benjaminrau
benjaminrau / PageMenu.html
Last active August 29, 2015 14:05
Manual rendering of page menus and different treatment for specific page uids
<div xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="MainMenu">
<ul class="nav">
<v:page.menu pageUid="{settings.mainMenuRootPageUid}" entryLevel="2" levels="2" expandAll="TRUE" as="menu">
<f:for each="{menu}" as="item">
<v:switch value="{item.uid}">
<v:case case="{settings.pageUidToDoSmthElse}" break="TRUE">
<li class="{item.class} dropdown">
<div xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:m="http://typo3.org/ns/thememedialight/ViewHelpers">
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="blocmenu" label="LLL:flux.blocmenu" >
<flux:form.sheet name="colSettings" label="Grille">
<flux:field.input label="Awesome test V2" name="version"/>
@benjaminrau
benjaminrau / Controller.php
Created September 3, 2014 13:23
Move Record
/**
* Move Record
*
* @param integer $recordUid
* @param integer $referenceRecordUid
* @param string $position
* @return string
*/
public function moveRecordAction($recordUid, $referenceRecordUid, $position = 'after') {
/* @var \t3lib_TCEmain $tce */
@benjaminrau
benjaminrau / Detail.html
Created September 12, 2014 10:28
Switch news detail view template based on parent category
<f:section name="Main">
<f:if condition="{newsItem}">
<v:switch value="{newsItem.categories -> v:iterator.extract(key: 'parentcategory') -> v:iterator.extract(key: 'uid') -> v:iterator.first() -> v:or(alternative: 0)}">
<v:case case="{v:variable.typoscript(path: 'plugin.tx_mmstemplates.settings.campaignsRootCategoryUid')}" break="TRUE">
<f:render partial="News/Detail/Campaign" section="Main" arguments="{_all}" />
</v:case>
<v:case case="default">
<f:render partial="News/Detail/Default" section="Main" arguments="{_all}" />
</v:case>
</v:switch>
@benjaminrau
benjaminrau / ext_tables.php
Last active August 29, 2015 14:06
How to enable Context Sensitive Help (CSH)
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tx_mamsurvey_domain_model_questionaire',
'EXT:mamsurvey/Resources/Private/Language/locallang_csh_tx_mamsurvey_domain_model_questionaire.xml'
);
Before 6.X:
t3lib_extMgm::addLLrefForTCAdescr(
'tx_mamsurvey_domain_model_questionaire',
'EXT:mamsurvey/Resources/Private/Language/locallang_csh_tx_mamsurvey_domain_model_questionaire.xml'
);
@benjaminrau
benjaminrau / setup.ts
Created September 15, 2014 11:41
Different wrappers for different csc cTypes
# wrap content elements of main content area
tt_content {
stdWrap.outerWrap.cObject = CASE
stdWrap.outerWrap.cObject {
key.field = colPos
default = TEXT
default.value = |
0 = CASE
0 {
key.field = CType
@benjaminrau
benjaminrau / shell_log.txt
Last active August 29, 2015 14:06
Setup virtual machine and typo3 with one command
Benjamin-Rau-iMac:~ benjaminrau$ git clone https://github.com/benjaminrau/devbox && cd devbox && ./up
Cloning into 'devbox'...
remote: Counting objects: 117, done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 117 (delta 19), reused 39 (delta 2)
Receiving objects: 100% (117/117), 32.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (19/19), done.
Checking connectivity... done
Bringing machine 't3devbox' up with 'virtualbox' provider...
==> t3devbox: Importing base box 'vagrant-debian-wheezy64'...
// Export Layer Coordinates - Adobe Photoshop Script
// Description: Export x and y coordinates to comma seperated .txt file
// Requirements: Adobe Photoshop CS5 (have not tested on CS4)
// Version: 1.0-beta1.1, 8/31/2011
// Author: Chris DeLuca
// Company: Playmatics
// ===============================================================================
// Installation:
// 1. Place script in
// Mac: '~/Applications/Adobe Photoshop CS#/Presets/Scripts/'
# #
# Security policy for the Cf.Shop package #
# #
resources:
methods:
Cf_Shop: 'method(Cf\Shop\Controller\ShopController->.*Action())'
Cf_Shop_ShopAdmin_Person: 'method(Cf\Shop\Controller\PersonController->.*Action())'
Cf_Shop_ShopAdmin_Order: 'method(Cf\Shop\Controller\OrderController->.*Action())'