Typo3 - Tipps und Tricks: Unterschied zwischen den Versionen
| Zeile 6: | Zeile 6: | ||
[[Typo3 - Content Elemente anpassen]] | [[Typo3 - Content Elemente anpassen]] | ||
| + | |||
| + | === Neuste Inhalte anzeigen === | ||
| + | Quelle: http://typo3.umloud.dk/index.php?id=360 22.5.2006 | ||
| + | |||
| + | <pre> | ||
| + | This shows the content elements in the normal column of the page last created/edited. | ||
| + | |||
| + | Note: "tstamp" ONLY get changed/set when you create a new page, or edit the page header NOT when you insert a content element on a page.. | ||
| + | |||
| + | lib.newestContent = COA | ||
| + | lib.newestContent { | ||
| + | # First we collect the uids on all levels of the site | ||
| + | |||
| + | # Gets the uids on 1st level | ||
| + | 10 = LOAD_REGISTER | ||
| + | 10.level1uids.cObject = CONTENT | ||
| + | 10.level1uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.data = leveluid:0 | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # Gets the uids on 2nd level | ||
| + | 20 = LOAD_REGISTER | ||
| + | 20.level2uids.cObject = CONTENT | ||
| + | 20.level2uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.cObject = TEXT | ||
| + | select.pidInList.cObject.data = register:level1uids | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # Gets the uids on 3rd level | ||
| + | 30 = LOAD_REGISTER | ||
| + | 30.level3uids.cObject = CONTENT | ||
| + | 30.level3uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.cObject = TEXT | ||
| + | select.pidInList.cObject.data = register:level2uids | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # Gets the uids on 4th level | ||
| + | 40 = LOAD_REGISTER | ||
| + | 40.level4uids.cObject = CONTENT | ||
| + | 40.level4uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.cObject = TEXT | ||
| + | select.pidInList.cObject.data = register:level3uids | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # Gets the uids on 5th level | ||
| + | 50 = LOAD_REGISTER | ||
| + | 50.level5uids.cObject = CONTENT | ||
| + | 50.level5uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.cObject = TEXT | ||
| + | select.pidInList.cObject.data = register:level4uids | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # Gets the uids on 6th level | ||
| + | 60 = LOAD_REGISTER | ||
| + | 60.level5uids.cObject = CONTENT | ||
| + | 60.level5uids.cObject { | ||
| + | table = pages | ||
| + | select.pidInList.cObject = TEXT | ||
| + | select.pidInList.cObject.data = register:level5uids | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | renderObj.wrap = |, | ||
| + | } | ||
| + | |||
| + | # next we combine all of them into one list of uids | ||
| + | 70 = LOAD_REGISTER | ||
| + | 70.alluids.cObject = COA | ||
| + | 70.alluids.cObject { | ||
| + | 10 = TEXT | ||
| + | 10.data = register:level1uids | ||
| + | |||
| + | 20 = TEXT | ||
| + | 20.data = register:level2uids | ||
| + | |||
| + | 30 = TEXT | ||
| + | 30.data = register:level3uids | ||
| + | |||
| + | 40 = TEXT | ||
| + | 40.data = register:level4uids | ||
| + | |||
| + | 50 = TEXT | ||
| + | 50.data = register:level5uids | ||
| + | |||
| + | 60 = TEXT | ||
| + | 60.data = register:level6uids | ||
| + | |||
| + | 70 = TEXT | ||
| + | 70.data = leveluid:0 | ||
| + | } | ||
| + | |||
| + | # Test output | ||
| + | #75 = TEXT | ||
| + | #75.data = register:alluids | ||
| + | #75.wrap = [|]<br> | ||
| + | |||
| + | # More Testoutput | ||
| + | 80 = CONTENT | ||
| + | 80 { | ||
| + | table = pages | ||
| + | select { | ||
| + | pidInList.data = register:alluids | ||
| + | orderBy = tstamp DESC | ||
| + | max = 1 | ||
| + | } | ||
| + | renderObj = COA | ||
| + | renderObj { | ||
| + | 10 = TEXT | ||
| + | 10.field = title | ||
| + | 10.wrap = The newest page is: <b>|</b> | ||
| + | 20 = TEXT | ||
| + | 20.field = tstamp | ||
| + | 20.strftime = %d-%b-%Y %H:%M:%S | ||
| + | 20.wrap = which was last edited: |<br> | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # And the final output of the content elements | ||
| + | 90 = COA | ||
| + | 90 { | ||
| + | wrap = And here are the content in the normal column of that page:<hr>|<hr> | ||
| + | 10 = CONTENT | ||
| + | 10 { | ||
| + | table = tt_content | ||
| + | select { | ||
| + | orderBy = sorting | ||
| + | where = colPos=0 | ||
| + | languageField = sys_language_uid | ||
| + | pidInList.cObject = CONTENT | ||
| + | pidInList.cObject { | ||
| + | table = pages | ||
| + | select { | ||
| + | pidInList.data = register:alluids | ||
| + | orderBy = tstamp DESC | ||
| + | max = 1 | ||
| + | } | ||
| + | renderObj = TEXT | ||
| + | renderObj.field = uid | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </pre> | ||
| + | |||
=== Einstellungen für Bilder === | === Einstellungen für Bilder === | ||
Version vom 22. Mai 2006, 10:46 Uhr
mehr auf Typo3 - TS Templates und: Typo3 - Wichtige TypoScript Einstellungen
Rendering von Content Elementen
weitere Infos unter:
Typo3 - Content Elemente anpassen
Neuste Inhalte anzeigen
Quelle: http://typo3.umloud.dk/index.php?id=360 22.5.2006
This shows the content elements in the normal column of the page last created/edited.
Note: "tstamp" ONLY get changed/set when you create a new page, or edit the page header NOT when you insert a content element on a page..
lib.newestContent = COA
lib.newestContent {
# First we collect the uids on all levels of the site
# Gets the uids on 1st level
10 = LOAD_REGISTER
10.level1uids.cObject = CONTENT
10.level1uids.cObject {
table = pages
select.pidInList.data = leveluid:0
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# Gets the uids on 2nd level
20 = LOAD_REGISTER
20.level2uids.cObject = CONTENT
20.level2uids.cObject {
table = pages
select.pidInList.cObject = TEXT
select.pidInList.cObject.data = register:level1uids
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# Gets the uids on 3rd level
30 = LOAD_REGISTER
30.level3uids.cObject = CONTENT
30.level3uids.cObject {
table = pages
select.pidInList.cObject = TEXT
select.pidInList.cObject.data = register:level2uids
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# Gets the uids on 4th level
40 = LOAD_REGISTER
40.level4uids.cObject = CONTENT
40.level4uids.cObject {
table = pages
select.pidInList.cObject = TEXT
select.pidInList.cObject.data = register:level3uids
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# Gets the uids on 5th level
50 = LOAD_REGISTER
50.level5uids.cObject = CONTENT
50.level5uids.cObject {
table = pages
select.pidInList.cObject = TEXT
select.pidInList.cObject.data = register:level4uids
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# Gets the uids on 6th level
60 = LOAD_REGISTER
60.level5uids.cObject = CONTENT
60.level5uids.cObject {
table = pages
select.pidInList.cObject = TEXT
select.pidInList.cObject.data = register:level5uids
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
# next we combine all of them into one list of uids
70 = LOAD_REGISTER
70.alluids.cObject = COA
70.alluids.cObject {
10 = TEXT
10.data = register:level1uids
20 = TEXT
20.data = register:level2uids
30 = TEXT
30.data = register:level3uids
40 = TEXT
40.data = register:level4uids
50 = TEXT
50.data = register:level5uids
60 = TEXT
60.data = register:level6uids
70 = TEXT
70.data = leveluid:0
}
# Test output
#75 = TEXT
#75.data = register:alluids
#75.wrap = [|]<br>
# More Testoutput
80 = CONTENT
80 {
table = pages
select {
pidInList.data = register:alluids
orderBy = tstamp DESC
max = 1
}
renderObj = COA
renderObj {
10 = TEXT
10.field = title
10.wrap = The newest page is: <b>|</b>
20 = TEXT
20.field = tstamp
20.strftime = %d-%b-%Y %H:%M:%S
20.wrap = which was last edited: |<br>
}
}
# And the final output of the content elements
90 = COA
90 {
wrap = And here are the content in the normal column of that page:<hr>|<hr>
10 = CONTENT
10 {
table = tt_content
select {
orderBy = sorting
where = colPos=0
languageField = sys_language_uid
pidInList.cObject = CONTENT
pidInList.cObject {
table = pages
select {
pidInList.data = register:alluids
orderBy = tstamp DESC
max = 1
}
renderObj = TEXT
renderObj.field = uid
}
}
}
}
}
Einstellungen für Bilder
Größe (maximal, minimal, Popups, Skalierung, Bildunterschriften...)
Border Attribut loswerden
config.config.disableImgBorderAttr = 1
Wichtig wenn man mit CSS arbeiten möchte.
Link to Top
Darstellung von Tabellen
Betrifft hauptsächlich das static Template content(default)
clear.gif und Absätze loswerden
content(default)
# Entfernen der <img src="clear.gif' ...> content.headerSpace = 0|0 content.space = 0|0
externe Links
_self oder _blank, aussehen...
styles.content.links.extTarget (bei css_styled_content)
Links und Sitemap
Die Links einer eingebundenen Sitemap sind standardmäßig auf den Wert 'page' eingestellt (Typo 3.8). Das macht nur bei Framesets Sinn.
Die relevanten Setup-Werte die man ändern muß (je nach ausgewählter Sitemap):
tt_content.menu.20.1.1.target = _self tt_content.menu.20.2. [...]
Listenpunkte und Aufzählungen
Layoutauswahl
siehe Typo3 - Rahmen (Frames) für Rahmen
und Typo3 - Backend anpassen für Header (Überschriften)
Inline CSS loswerden
Bei vielen Extensions und bei CSS Styled ImgText liegt das CSS Inline. Besser wäre ist es das CSS komplett in eigene Dateien auszulagern.
# Inline Styles auslagern config.inlineStyle2TempFile = true
JavaScript in externe Datei auslagern
Z.B. der kleine JavaScript Schnipsel für das Blur im IE auslagern. Wie bindet man externes JavaScript ein...
siehe unter Typo3 - HTML Code optimieren
Ausgabe einer Spalte Wrappen
Beispiel:
#Inhalt rechts subparts.CONTENT_RIGHT < styles.content.getRight #Ganze Spalte Wrappen subparts.CONTENT_RIGHT.wrap = <div class="content_right"> | </div> #Einzelnes Element Wrappen subparts.CONTENT_RIGHT.renderObj.stdWrap.wrap=<div class="bordered">|</div>
Ausgabe einer Spalte Wrappen wenn nicht leer
Hier wird das content element nur mit einem div gewrapt wenn es nicht leer ist
temp.rightContent < styles.content.getRight
temp.rightContent.stdWrap {
wrap = <div id="right-main"> | </div>
if.isTrue.numRows < styles.content.getRight
}
(TypoWizard.com 9.1.2006)
p style="margin:0 0 0 0;" aus dem p-Tag rausnehmen
tt_content.text.20.parseFunc.nonTypoTagStdWrap.encapsLines.addAttributes.P.style=
Backend anpassen
Content element wizard ändern
aus http://krungkuene.org/krung/wiki/Typo3.html 18.5.2006
Dafür erweitere die php-Klasse SC_db_new_content_el und speichere diese datei unter typo3conf/ux_SC_db_new_content_el.php
<?php
class ux_SC_db_new_content_el extends SC_db_new_content_el {
// Modify the Wizard Array, which holds the values shown at create new
//record page:
function wizardArray() {
global $LANG,$TBE_MODULES_EXT;
$wizardItems = array(
"common" => array("header"=>"Typical page content"),
'common_1' => array(
"icon"=>'../typo3conf/hos/intext_left_wi.gif',
'title'=>'Text with Image to the left',
'description'=>'A regular text element which contains a image positioned left to the text',
'params'=>'&defVals[tt_content][CType]=textpic&defVals[tt_content][imageorient]=26&defVals[tt_content][imagewidth]=80',
),
"common_2" => array(
"icon"=>'../typo3conf/hos/fdfx_2cols.gif',
"title"=>'Two Column Text',
"description"=>'A Text with two Column',
'params'=>'&defVals[tt_content][CType]=fdfx_2cols_pi1'
),
'common_3' => array(
"icon"=>'../typo3conf/hos/intext_right_wi.gif',
'title'=>'Text with big Image to the right',
'description'=>'A regular text element which contains a image positioned right to the text',
'params'=>'&defVals[tt_content][CType]=textpic&defVals[tt_content][imageorient]=25&defVals[tt_content][imagewidth]=480',
'tt_content_defValues' => array(
'CType' => 'textpic',
'imageorient' => 25,
'imagewidth' => 480,
)
),
);
return $wizardItems;
}
}
?>
Um das ganze auch zu verwenden, mache diesen Eintrag in typo3conf/localconf.php
$TYPO3_CONF_VARS["BE"]["XCLASS"]["ext/cms/layout/db_new_content_el.php"] = PATH_typo3conf."class.ux_db_new_content_el.php";
Suche
Index-Suche – kein eigenes Fenster öffnen
Constants
styles.content.searchresult.resultTarget = _self styles.content.searchresult.target = _self
Domains anlegen
Todo...
Ein Beispiel bei dem zusätzlich Englisch (L=1) berücksichtigt wird.
temp.rootline_html= HMENU
temp.rootline_html.special = rootline
temp.rootline_html.special.range = 0|-1
temp.rootline_html.1 = TMENU
temp.rootline_html.1 {
wrap = Sie sind hier: |
# evt. bestimte Seiten ausblenden...
excludeUidList =
# Sprache mit der ID 1 (Englisch)
target = _top
NO {
linkWrap= <span class="pathway">|</span>
# optionSplit: vor erstem item kein delimiter, sonst immer einer
allWrap = | |*| > | |*|
ATagBeforeWrap = 0
}
}
# Wrap für Englisch
[globalVar = GP:L = 1]
temp.rootline_html.1.wrap = You are here: |
[global]
Mehrsprachigkeit
So baut man mehrsprachige Seiten in Typo3:
Typo3 - Mehrsprachige Navigation
Spracheinstellungen
HTML-Template einbinden
siehe auch: Typo3 - HTML-Templates Beispiel (das page Objekt muß natürlich vorher definiert werden):
Im TS Template Setup:
page.10 = TEMPLATE
page.10{
template = FILE
template.file = fileadmin/templates/main.html
### Subparts ansprechen ###
workOnSubpart = DOCUMENT_BODY
# Rootline (Pathway) einfügen ###
subparts.ROOTLINE < temp.rootline_html
# Hauptinhalt
subparts.CONTENT < layoutWrap
subparts.CONTENT.wrap = <div class="content"> | </div>
#Inhalt rechts
subparts.CONTENT_RIGHT < styles.content.getRight
subparts.CONTENT_RIGHT.wrap = <div class="content"> | </div>
# Rand bzw. Header
subparts.HEADER < styles.content.getBorder
subparts.HEADER <div class="header"> | </div>
# subparts.HEADER < temp.flashHeader
### Hauptnavigation ###
subparts.NAVI_LINKS < temp.navi_gLayer
### rechte Navi ###
subparts.NAVI_RECHTS <temp.naviGRight
}
Einstellungen für das Page Objekt
Verschiedene Einstellungen
statische Seiten Simulieren
Statische Seiten simulieren
config.simulateStaticDocuments = PATH_INFO config.simulateStaticDocuments_addTitle = 30 config.simulateStaticDocuments = 1 config.admPanel = 1 config.simulateStaticDocuments_noTypeIfNoTitle = 1
.htaccess Datei für Apache Server nicht vergessen (muß nur unbenannt werden)
Einstellungen für das Admin Panel
Spamschutz für Email Adressen
config.spamProtectEmailAddresses = 1 config.spamProtectEmailAddresses_atSubst = (at)
E-Mail-Absender für automatische E-Mails z.B. über Kontaktformular
E-Mail-Adresse
plugin.feadmin.dmailsubscription.email = info(at)easy-office4you.de
E-Mail-Name
plugin.feadmin.dmailsubscription.emailName = Barbara Hofbauer
Typo3 RTE - Einstellungen
RTE Absatz Formatierung einstellen
lib.parseFunc_RTE {
nonTypoTagStdWrap.encapsLines.nonWrappedTag >
nonTypoTagStdWrap.encapsLines.wrapNonWrappedLines = |
}
HTML-Area (htmlarea) statt RTE
Mit der Extension htmlarea kann man den RTE ersetzen. Er bietet einiges mehr an Bearbeitungsfunktionen (wenn man die denn will) aber vor allem läuft er auch auf Mozilla, Firefox, etc. Browsern.
htmlarea anpassen
Die Möglichkeiten des htmlarea Editors sind oft zuviel des Guten. Die meisten Anpassungen des RTE funktionieren auch im htmlarea. Beispiele:
Minimale Funktionalität
Im Page Setup:
RTE.default {
## Toolbar options applicable to all RTE's
## The TCA configuration may add buttons to the toolbar
showButtons = bold,italic,undo,redo,about
}
- front end RTE configuration for the general public (htmlArea RTE only)
RTE.default.FE < RTE.default