Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Extension Development, add Page TSconfig, User TSconfig and TS

From TYPO3Wiki
Jump to: navigation, search

notice - This information is outdated

While some details may still apply in specific situations, this page was written for packages of TYPO3 that are no longer current.


<< Back to Extension Development << Back to Developer manuals page

[edit]

Basic extension for adding default Page TSconfig, User TSconfig and Typoscript

This is a very basic extension that simply sets various configuration options by default.

notice - Draft

Change the {{draft}} marker to {{review}} when you need a reviewer for text and TypoScript. info

notice - Note

Please, no one upload this to the repository without making it quite a lot more sophisticated and configurable. IMO, this code is suitable for private extensions only.

To build the extension, simply

  1. Create each of the following files with titles exactly as shown
  2. Replace each occurrence of ###extension_key###, ###author_name###, and ###author_company### with a real extension key, author name and author company
  3. Include a 18px wide by 16px high .gif file called ext_icon.gif in the directory
  4. Place all files into a directory called ###extensionkey### (no spaces or '_') in your site's typo3conf/ext/ directory
  5. In the BE, go to Extension Manager > Backup/Delete and click one of the links to download the extension as a compressed or uncompressed file; your browser will prompt you to download a .t3x file which you can then import into the extension manager of any new site you develop.


ChangeLog

(add new changes on top of this file)

05-08-09  ###author_name### <###author_email###>

	* Initial release

ext_conf_template.txt

activating TSconfig

notice - This information is outdated

TYPO3 6.0 does not support this 2 settings any more. Instead you should use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($content) or \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig($content) in your extension's ext_localconf.php to add pageTSconfig or userTSconfig. You can still include files by using e.g. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extension_key/Configuration/TypoScript/pageTsConfig.ts">');


  # cat=basic/enable; type=boolean; label=Set PageTSconfig by default: If you are going to use this extension by 
  # default in this database then set this flag. In that case you don't need to set specific PageTSconfig for each 
  # page, which you have to do otherwise!
setPageTSconfig = 1

  # cat=basic/enable; type=boolean; label=Set UserTSconfig by default: If you are going to use this extension by 
  # default in this database then set this flag. In that case you don't need to set specific UserTSconfig for 
  #each user/group, which you have to do otherwise!
setUserTSconfig = 1

ext_emconf.php

<?php

########################################################################
# Extension Manager/Repository config file for ext: "###extension_key###"
# 
# Auto generated 04-09-2005 01:42
# 
# Manual updates:
# Only the data in the array - anything else is removed by next write
########################################################################

$EM_CONF[$_EXTKEY] = Array (
	'title' => 'Pre Config',
	'description' => 'Pre-configures TS Setup, TS Constants, User TSConfig and Page TSConfig',
	'category' => 'misc',
	'shy' => 0,
	'dependencies' => '',
	'conflicts' => '',
	'priority' => '',
	'loadOrder' => '',
	'TYPO3_version' => '0.0.3-0.0.3',
	'PHP_version' => '0.0.3-0.0.3',
	'module' => '',
	'state' => 'stable',
	'internal' => 0,
	'uploadfolder' => 0,
	'createDirs' => '',
	'modify_tables' => '',
	'clearCacheOnLoad' => 0,
	'lockType' => '',
	'author' => '###author_name###',
	'author_email' => '###author_email###',
	'author_company' => '###author_company###',
	'CGLcompliance' => '',
	'CGLcompliance_note' => '',
	'private' => 0,
	'download_password' => '',
	'version' => '1.0.5',	// Don't modify this! Managed automatically during upload to repository.
	'_md5_values_when_last_written' => 'a:8:{s:9:"ChangeLog";s:4:"696c";s:21:"ext_conf_template.txt";s:4:"2a85";s:12:"ext_icon.gif";s:4:"29a1";s:17:"ext_localconf.php";s:4:"306a";s:28:"ext_typoscript_constants.txt";s:4:"2535";s:24:"ext_typoscript_setup.txt";s:4:"9373";s:16:"pageTSconfig.txt";s:4:"5377";s:16:"userTSconfig.txt";s:4:"c2c4";}',
);

?>

ext_localconf.php

<?php
# TYPO3 CVS ID: $Id: ext_localconf.php,v 1.1 2004/11/16 15:21:46 typo3 Exp $

if (!defined ('TYPO3_MODE')) 	die ('Access denied.');

$_EXTCONF = unserialize($_EXTCONF);	// unserializing the configuration so we can use it here:
if ($_EXTCONF['setPageTSconfig'])	{
	t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:###extension_key###/pageTSconfig.txt">');
}

if ($_EXTCONF['setUserTSconfig']) {
	t3lib_extMgm::addUserTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:###extension_key###/userTSconfig.txt">');
}

//t3lib_extMgm::addPItoST43($_EXTKEY,'pi1/class.tx_###extension_key###_pi1.php','_pi1','list_type',1);
?>


ext_typoscript_constants.txt

### No link targets by default!
PAGE_TARGET = 
styles.content.links.extTarget = 

config {
  extTarget = 

  metaCharset = 
  doctype = xhtml_trans
  xmlprologue = none

  htmlTag_langKey = en

  removeDefaultJS = 1

  inlineStyle2TempFile = 1

  spamProtectEmailAddresses = 2
  spamProtectEmailAddresses_atSubst = [at]

  removeDefaultJS = external

  stat = 1
  stat_apache = 1
  stat_apache_logfile = 
  stat_typeNumList = 0,1

  simulateStaticDocuments = 1
  simulateStaticDocuments_noTypeIfNoTitle = 1
  simulateStaticDocuments_pEnc = md5
  simulateStaticDocuments_pEnc_onlyP = 

  headerComment (
    Site design & implementation by ###company_name###	
				
        Thanks to Kasper Skaarhoj & the Typo3 community!
  )

  notification_email_urlmode = 76

  admPanel = 1

  xhtml_cleaning = all

  disablePrefixComment = 1
}

ext_typoscript_setup.txt

config {
  ### Items included in TSref order for convenience.
  ### For more details, see TSref at: https://docs.typo3.org/typo3cms/TyposcriptReference/

  extTarget = {$config.extTarget}

  metaCharset = {$config.metaCharset}
  doctype = {$config.doctype}
  xmlprologue = {$config.xmlprologue}
  htmlTag_langKey = {$config.htmlTag_langKey}

  removeDefaultJS = {$config.removeDefaultJS}
  inlineStyle2TempFile = {$config.inlineStyle2TempFile}

  spamProtectEmailAddresses = {$config.spamProtectEmailAddresses}
  spamProtectEmailAddresses_atSubst = {$config.spamProtectEmailAddresses_atSubst}
  removeDefaultJS = {$config.removeDefaultJS}

  stat = {$config.stat}
  stat_apache = {$config.stat_apache}
  stat_apache_logfile = {$config.stat_apache_logfile}
  stat_typeNumList = {$config.stat_typeNumList}

  simulateStaticDocuments = {$config.simulateStaticDocuments}
  simulateStaticDocuments_noTypeIfNoTitle = {$config.simulateStaticDocuments_noTypeIfNoTitle}
  simulateStaticDocuments_pEnc = {$config.simulateStaticDocuments_pEnc}
  simulateStaticDocuments_pEnc_onlyP = {$config.simulateStaticDocuments_pEnc_onlyP}

  headerComment (
    {$config.headerComment}
  )

  notification_email_urlmode = {$config.notification_email_urlmode}

  admPanel = {$config.admPanel}

  xhtml_cleaning = {$config.xhtml_cleaning}

  disablePrefixComment = {$config.disablePrefixComment}
}

### Get rid of 'class="bodytext"' that's bizarrely applied to EVERY <p> by default:
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes >

### Make headers' markup simpler and add <h6>:
lib.stdheader.10 {
  1.fontTag = <h1>|</h1>
  2.fontTag = <h2>|</h2>
  3.fontTag = <h3>|</h3>
  4.fontTag = <h4>|</h4>
  5.fontTag = <h5>|</h5>

  6 = TEXT
  6 {
    current = 1
    insertData = 1
    fontTag = <h6>|</h6>
  }

  ### Make sure there're no annoying divs wrapped around hx elements:
  stdWrap.dataWrap >
}

### Redefine the Sitemap to something usable (nested unordered lists, up to 4 levels deep):
### 

tt_content.menu.20.2.2 >
tt_content.menu = HMENU
tt_content.menu {
  1 = TMENU
  1 {
    wrap = <ul id="sitemap">|</ul>

    noBlur = 1
    expAll = 1

    NO.wrapItemAndSub = <li>|</li>
  }

  2 < .1
  2.wrap = <ul>|</ul>

  3 < .2
  4 < .2
}

pageTSconfig.txt

notice - This information is outdated

TYPO3 6.0 does not support this file any more. Instead you should use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig($content) in your extension's ext_localconf.php to add pageTSconfig. You can still include files by using e.g. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extension_key/Configuration/TypoScript/pageTsConfig.ts">');


RTE.default {
  contentCSS = {$RTE_stylesheet}
  showTagFreeClasses = 0
  classesCharacter =
  classesImage = 
  classesAnchor = 

  removeComments = 1 
  removeTags = font
  removeTagsAndContents = style, script

  removeTrailingBR = 1

  # Match these items to "TCEFORM.tt_content.header_layout.removeItems" list below
  hidePStyleItems = h4,h5,h6,address

  useCSS = 0
}

RTE.default.hideButtons =  line, textcolor, bgcolor, fontstyle, fontsize, lefttoright, righttoleft, justifyfull, outdent, indent, emoticon, table, showhelp, about, toggleborders, tableproperties, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, columninsertbefore, columninsertafter, columndelete, columnsplit, cellproperties, cellinsertbefore, columninsertafter, celldelete, cellsplit, cellmerge, inserttag, user 
# Showing: blockstylelabel,blockstyle,textstylelabel, textstyle, formatblock, bold, italic, underline, strikethrough, subscript, superscript, left, center, right, orderedlist, unorderedlist, link, image, insertcharacter, acronym, findreplace, spellcheck, chMode, removeformat, copy, cut, paste, undo, redo,

RTE.default.hidePStyleItems = PRE
RTE.default.toolbarOrder = chMode, bar, blockstylelabel,blockstyle,textstylelabel, formatblock, textindicator, bar, removeformat, bar, image, link, linebreak,  insertcharacter, acronym, bar, bold, italic, underline, strikethrough, subscript, superscript, bar, left, center, right, bar, orderedlist, unorderedlist, linebreak, copy, cut, paste, bar, undo, redo, bar, findreplace, spellcheck, bar

mod.xMOD_alt_doc {
  disableDocSelector = 1
  disableCacheSelector = 1
}

TCEFORM.pages {
  layout.disabled = 1 
  lastUpdated.disabled = 1
  newUntil.disabled = 1 

  target.disabled = 1
  no_cache.disabled = 1
  cache_timeout.disabled = 1
  
  abstract.disabled = 1
  keywords.disabled = 1
  author.disabled = 1
  email.disabled = 1
  description.disabled = 1 

  fe_login_mode.disabled = 1
  module.disabled = 1
}

TCEFORM.tt_content {
  header_layout.altLabels.1 = Heading 1
  header_layout.altLabels.2 = Heading 2
  header_layout.altLabels.3 = Heading 3
  header_layout.altLabels.4 = Heading 4
  header_layout.altLabels.5 = Heading 5
	
  header_layout.removeItems = 100
  header_layout.addItems.6 = Heading 6
  header_layout.addItems.99 = Hidden

  CType.removeItems = textpic,bullets,login,image,script,html,upload,div,splash,uploads

  sys_language_uid.disabled = 1
  colPos.disabled = 1
  spaceBefore.disabled = 1
  spaceAfter.disabled = 1
  section_frame.disabled = 1
}

userTSconfig.txt

notice - This information is outdated

TYPO3 6.0 does not support this file any more. Instead you should use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig($content) in your extension's ext_localconf.php to add userTSconfig. You can still include files by using e.g. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extension_key/Configuration/TypoScript/userTsConfig.ts">');


TS TypoScript:
# Set default values for table "pages"
TCAdefaults.pages {
  # set default value for hidden-field
  hidden=1
  # set default value for page type
  doktype=2
}

admPanel {
  enable.preview = 1
  enable.cache = 0
  enable.publish = 0
  enable.edit = 0
  enable.tsdebug = 0
  enable.info = 0
}

options {
  clearCache.pages = 1
  saveDocNew = 1
}