Typo3 - Tipps und Tricks: Unterschied zwischen den Versionen
Kholja (Diskussion | Beiträge) |
|||
| Zeile 306: | Zeile 306: | ||
$TYPO3_CONF_VARS["BE"]["XCLASS"]["ext/cms/layout/db_new_content_el.php"] = PATH_typo3conf."class.ux_db_new_content_el.php"; | $TYPO3_CONF_VARS["BE"]["XCLASS"]["ext/cms/layout/db_new_content_el.php"] = PATH_typo3conf."class.ux_db_new_content_el.php"; | ||
| + | |||
| + | |||
| + | === Login Bild im Backend anpassen === | ||
| + | |||
| + | Quelle: http://www.allanime.org/?id=143 | ||
| + | |||
| + | '''Introduction''' | ||
| + | |||
| + | The TYPO3 backend login displays a nice image left of the actual username/password login box. Currently an image of a pair of gloves is used. If you happen to install the CVS version of TYPO3 the image will differ from what you're used to see. I remember a yellow flower in older versions (3.6) of TYPO3 an image that is still present in /typo3/gfx/ named loginbox_image_360.jpg. What's happening there? | ||
| + | |||
| + | |||
| + | TYPO3 has a very cute feature which changes the login box image on certain circumstances. The code is actually in /typo3/index.php. Browsing this code I found another great feature: TYPO3 is also able to „rotate“ images given in a certain directory! All you have to do is, point TYPO3 to this directory. TYPO3 will load all image files in this directory and display a random image. | ||
| + | |||
| + | |||
| + | The way to show TYPO3 this directory is by setting the variable $TBE_STYLES['loginBoxImage_rotationFolder'] = path_to_dir/ | ||
| + | |||
| + | |||
| + | Unfortunately there is no way to to so without some programming. The TYPO3 init script explicitly deletes the whole array before initializing the backend. The only way to set variables is by creating an extension. | ||
| + | |||
| + | |||
| + | This super-short Mini-howto will tell you how to set up this wonderful feature in 5 easy steps. I will assume you have access to your webserver by FTP and can create directories and upload files by FTP. | ||
| + | |||
| + | '''This is a short overview how it works:''' | ||
| + | # Set up a folder with images | ||
| + | # Create an extension | ||
| + | # Add 1 line to this extension and point TYPO3 to your image directory | ||
| + | # Install extension | ||
| + | |||
| + | '''Setting Up the Image Folder''' | ||
| + | |||
| + | First you have to prepare the images. One image is fine but of course the more the better. The original images are 200x133 pixel in size, I suggest you create some cute images of the same size but it's not necessary. Allowed are png, jpg and gif images. | ||
| + | |||
| + | Log on to your website using your favorite FTP tool. You can also set up a TYPO3 filemount to do the same. | ||
| + | |||
| + | Go to the directory typo3conf/ | ||
| + | |||
| + | |||
| + | Create a new empty directory 'logonimages'. (Without quotes) | ||
| + | |||
| + | Copy the prepared images to this folder. | ||
| + | |||
| + | Create the Extension | ||
| + | |||
| + | |||
| + | Click images to enlarge. Image count from top to bottom. | ||
| + | |||
| + | „What? I never created an extension! I can never do this!“ - if that's what you say you're wrong. You can follow detailed instructions – and all we have to write is one single line of code – which you can as well copy from this document if you used the directory from the last step. | ||
| + | |||
| + | Log on to the TYPO3 backend as administrator. Ignore the ugly log on image <(^.^)> | ||
| + | |||
| + | |||
| + | |||
| + | In the Tool menu use „Ext Manager.“ Of course you need to have this module installed. Showing you how to install extensions from the TER (TYPO Extension Repository) is not goal of this Mini-HOWTO. | ||
| + | |||
| + | |||
| + | Chose the item „Make new extension“ from the dropdown menu. | ||
| + | |||
| + | |||
| + | In the field "Enter Extension key" you type "user_enhancelogin". Then click on the button "Update." | ||
| + | |||
| + | |||
| + | Click on the plus symbol next to the line saying „General Info.“ Fill the form like shown in image . Don't forget to hit the "Update" button! | ||
| + | [[Bild:ExtensionKickstarter01.jpg]] | ||
| + | |||
| + | |||
| + | In the menu to the left click on the plus symbol next to „Extend existing tables.“ You do not need to type something there. It's just done to create the empty framework for our single line of code. | ||
| + | |||
| + | |||
| + | |||
| + | At the bottom left of the content frame there is a button now saying „View Result.“ Click it. The result will look like that in image [4]. One really, really important note: Before proceeding you need to make sure in the location dropdown "LOCAL" is chosen! If you fail to do so, your extension might show up for all installations and - if installed -might yield in unexpected results. | ||
| + | |||
| + | |||
| + | |||
| + | Now click the "WRITE" button and the raw empty extension is created. | ||
| + | |||
| + | |||
| + | |||
| + | That wasn't too complicated, was it? | ||
| + | |||
| + | |||
| + | |||
| + | Programming | ||
| + | |||
| + | As a result of the last step, a basic framework of extension has been written to the directory /typo3conf/ext/user_enhancelogin/ | ||
| + | |||
| + | |||
| + | |||
| + | Now to the programming. Log on to your website using FTP and edit the following file: | ||
| + | |||
| + | |||
| + | |||
| + | typo3conf/user_enhancelogin/ext_tables.php | ||
| + | |||
| + | |||
| + | |||
| + | There are different ways to do this. Most advanced FTP programs have an "edit" button. Please refer to your FTP program's documentation. | ||
| + | |||
| + | |||
| + | |||
| + | Now this is what ext_tables.php should look like. As you can see there is only one line added. | ||
| + | |||
| + | <?php | ||
| + | if (!defined('TYPO3_MODE')) die('Access denied.') | ||
| + | $GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder'] = | ||
| + | '../typo3conf/logonimages'; | ||
| + | ?> | ||
| + | |||
| + | |||
| + | Installing the Extension | ||
| + | |||
| + | After saving the extension there should be a success message and a link to install your new extension. Click it. | ||
| + | |||
| + | In the menu to the left please click the link „Clear temp_CACHED.“ In case you ever wondered what this link is for – this it is. | ||
| + | |||
| + | Log out of the TYPO3 backend and test the setup. If you followed the instructions of this manual you should now see your prepared images instead of the glove. | ||
== Suche == | == Suche == | ||
Version vom 22. Mai 2006, 13:04 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";
Login Bild im Backend anpassen
Quelle: http://www.allanime.org/?id=143
Introduction
The TYPO3 backend login displays a nice image left of the actual username/password login box. Currently an image of a pair of gloves is used. If you happen to install the CVS version of TYPO3 the image will differ from what you're used to see. I remember a yellow flower in older versions (3.6) of TYPO3 an image that is still present in /typo3/gfx/ named loginbox_image_360.jpg. What's happening there?
TYPO3 has a very cute feature which changes the login box image on certain circumstances. The code is actually in /typo3/index.php. Browsing this code I found another great feature: TYPO3 is also able to „rotate“ images given in a certain directory! All you have to do is, point TYPO3 to this directory. TYPO3 will load all image files in this directory and display a random image.
The way to show TYPO3 this directory is by setting the variable $TBE_STYLES['loginBoxImage_rotationFolder'] = path_to_dir/
Unfortunately there is no way to to so without some programming. The TYPO3 init script explicitly deletes the whole array before initializing the backend. The only way to set variables is by creating an extension.
This super-short Mini-howto will tell you how to set up this wonderful feature in 5 easy steps. I will assume you have access to your webserver by FTP and can create directories and upload files by FTP.
This is a short overview how it works:
- Set up a folder with images
- Create an extension
- Add 1 line to this extension and point TYPO3 to your image directory
- Install extension
Setting Up the Image Folder
First you have to prepare the images. One image is fine but of course the more the better. The original images are 200x133 pixel in size, I suggest you create some cute images of the same size but it's not necessary. Allowed are png, jpg and gif images.
Log on to your website using your favorite FTP tool. You can also set up a TYPO3 filemount to do the same.
Go to the directory typo3conf/
Create a new empty directory 'logonimages'. (Without quotes)
Copy the prepared images to this folder.
Create the Extension
Click images to enlarge. Image count from top to bottom.
„What? I never created an extension! I can never do this!“ - if that's what you say you're wrong. You can follow detailed instructions – and all we have to write is one single line of code – which you can as well copy from this document if you used the directory from the last step.
Log on to the TYPO3 backend as administrator. Ignore the ugly log on image <(^.^)>
In the Tool menu use „Ext Manager.“ Of course you need to have this module installed. Showing you how to install extensions from the TER (TYPO Extension Repository) is not goal of this Mini-HOWTO.
Chose the item „Make new extension“ from the dropdown menu.
In the field "Enter Extension key" you type "user_enhancelogin". Then click on the button "Update."
Click on the plus symbol next to the line saying „General Info.“ Fill the form like shown in image . Don't forget to hit the "Update" button!
Datei:ExtensionKickstarter01.jpg
In the menu to the left click on the plus symbol next to „Extend existing tables.“ You do not need to type something there. It's just done to create the empty framework for our single line of code.
At the bottom left of the content frame there is a button now saying „View Result.“ Click it. The result will look like that in image [4]. One really, really important note: Before proceeding you need to make sure in the location dropdown "LOCAL" is chosen! If you fail to do so, your extension might show up for all installations and - if installed -might yield in unexpected results.
Now click the "WRITE" button and the raw empty extension is created.
That wasn't too complicated, was it?
Programming
As a result of the last step, a basic framework of extension has been written to the directory /typo3conf/ext/user_enhancelogin/
Now to the programming. Log on to your website using FTP and edit the following file:
typo3conf/user_enhancelogin/ext_tables.php
There are different ways to do this. Most advanced FTP programs have an "edit" button. Please refer to your FTP program's documentation.
Now this is what ext_tables.php should look like. As you can see there is only one line added.
<?php if (!defined('TYPO3_MODE')) die('Access denied.') $GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder'] =
'../typo3conf/logonimages';
?>
Installing the Extension
After saving the extension there should be a success message and a link to install your new extension. Click it.
In the menu to the left please click the link „Clear temp_CACHED.“ In case you ever wondered what this link is for – this it is.
Log out of the TYPO3 backend and test the setup. If you followed the instructions of this manual you should now see your prepared images instead of the glove.
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