Table of Contents

Allgemeines zu Typo3

Useful code

Debug your controller:

\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($yourVariable)

TYPOSCRIPT zu "direkten" Verlinkung in Menüs

### Menü ###
lib.infonavi = HMENU
lib.infonavi {
  special = directory
  special.value = PID
  wrap = |
  
  ### FIRST LEVEL
  1 = TMENU
  1 {
    NO {
      doNotLinkIt = 1
      wrapItemAndSub=<li>|</li>
      stdWrap.cObject = CASE
      stdWrap.cObject {
        key.field = doktype
        default = TEXT
        default {
          typolink.parameter.field = uid
          field = title
          stdWrap.htmlSpecialChars = 1
        }
        ### IF IS SHORTCUT
        4 = TEXT
        4 {
          field = title
          typolink.parameter.field = shortcut
        }
        ### IF IS EXTERNAL URL
        3 = TEXT
        3 {
          field = title
          typolink.parameter.field = url
          typolink.extTarget.field = target
        }
        
      }
    }
  }
}

TYPO3 Template Generator

Benutzung auf eigene Gefahr

Beschreibung

Verwendet ein bestehendes TYPO3 um daraus ein Template zur weiteren Verwendung zu erstellen.

Funktionen

Vor dem ersten Aufruf

Diese zwei Werte müssen angepasst werden.

### PATH TO GENERATE TYPO3 TEMPLATE FROM
templatefrom=/var/www/clients/client1/web1/web/typo3/

### PATH TO DROP THE TYPO3 GENERATED TEMPLATE FOLDER
templateto=/var/www/typo3_template/

Ablauf

  1. ./typo3template_generator.sh aufrufen
  2. Namen für den Template Ordner angeben, dieser wird mit Typo3 Versions und Datum&Uhrzeit erweitert
  3. In der letzten Zeile steht wo das Template zu finden ist:
    • ### DONE… CHECK TEMPLATE IN /var/www/typo3_template/huhu-v4.5-28_12_2011-18_55 ###

Benötigte Software

getestet unter CentOS 5.6

Skript

#!/bin/sh
 
### PATH TO GENERATE TYPO3 TEMPLATE FROM
templatefrom=/PATH/TO/TYPO3/
 
### PATH TO DROP THE TYPO3 GENERATED TEMPLATE FOLDER
templateto=/PATH/TO/TARGET/FOLDER/
 
 
 
### NOTHING TO BE CHANGED BELOW HERE
templatefromconf=${templatefrom}typo3conf/localconf.php
 
typo3version=$(grep -i "compat_version" ${templatefromconf} | sed "s/\$TYPO3_CONF_VARS\['SYS'\]\['compat_version'\] = '$1/$1/g" | sed "s/'.*//g")
 
echo ''
echo '### GENERATE TEMPLATE IN' $templateto '###'
echo ''
 
read -p 'Please enter name of template folder[e.g. vorlage-v3]: ' templatefolder
echo "Folder name: $templatefolder"
 
echo 'copying ...'
 
### PUT VARIABLES INTO VARIABLE
foldercreated=${templateto}${templatefolder}-v${typo3version}-$(date +%d_%m_%Y-%H_%M)
localconf=${foldercreated}/typo3conf/localconf.php
 
mkdir $foldercreated
cp -Rf $templatefrom/* $foldercreated
 
echo ''
echo '### CLEAR DATABASE SETTINGS IN' $templateto$templatefolder '###'
echo ''
 
sed -i "s/\$typo_db_username.*;/\$typo_db_username = '';/g" ${localconf}
echo '# SET $typo_db_username'
 
sed -i "s/\$typo_db_password.*;/\$typo_db_password = '';/g" ${localconf}
echo '# SET $typo_db_password'
 
sed -i "s/\$typo_db =.*;/\$typo_db = '';/g" ${localconf}
echo '# SET $typo_db'
 
sed -i "s/\$typo_db_host.*;/\$typo_db_host = 'localhost';/g" ${localconf}
echo '# SET $typo_db_host'
 
 
mysql_user=$(grep -i "typo_db_username = " ${templatefromconf} | sed "s/\$typo_db_username = '$1/$1/g" | sed "s/'.*//g")
mysql_password=$(grep -i "typo_db_password = " ${templatefromconf} | sed "s/\$typo_db_password = '$1/$1/g" | sed "s/'.*//g")
mysqldbname=$(grep -i "typo_db = " ${templatefromconf} | sed "s/\$typo_db = '$1/$1/g" | sed "s/'.*//g")
mysql_host=$(grep -i "typo_db_host = " ${templatefromconf} | sed "s/\$typo_db_host = '$1/$1/g" | sed "s/'.*//g")
 
echo ''
echo '### EXPORT TEMPLATE DATABASE' $mysqldbname '###'
 
mysqldump $mysqldbname > ${foldercreated}/typo3conf/typo3_template-db.sql -u $mysql_user -p$mysql_password
 
echo ''
echo '### REMOVE deprecation*.log in' $foldercreated '###'
 
find $foldercreated -name deprecation*.log -delete
 
echo ''
echo '### DONE... CHECK TEMPLATE IN' $foldercreated '###'

Download

Download Typo3 Template Generator