[Typo3-german] Menu mit Automaketemplate

Stefan Fricke sfricke at sfricke.de
Tue Sep 27 00:21:57 CEST 2005


Am Montag, 26. September 2005 22:52 schrieb Markus Stauffiger:
> Hallo Stefan
>
> Schau Dir doch das "Modern Template Building"-Tutorial an, dort wird
> Schritt für Schritt erklärt wie Du das machen kannst.
>
> http://typo3.org/documentation/document-library/doc_tut_templsel_de/

Das habe ich getan. Das Script sieht so aus: 

# Configuring the Auto-Parser for main template:
plugin.tx_automaketemplate_pi1 {
    # Read the template file:
  content = FILE
  content.file = fileadmin/template/main/template_1.html
 
    # Here we define which elements in the HTML that 
    # should be wrapped in subpart-comments:
  elements {
    BODY.all = 1
    BODY.all.subpartMarker = DOCUMENT_BODY
 
    HEAD.all = 1
    HEAD.all.subpartMarker = DOCUMENT_HEADER
    HEAD.rmTagSections = title
 
    DIV.all = 1
  }
 
    # Prefix all relative paths with this value:
  relPathPrefix = fileadmin/template/main/
}
 
# Menu cObject
temp.menu = HMENU
  # First level menu-object, textual
temp.menu.1 = TMENU
temp.menu.1 {
ACT = 1
ACT.allWrap =  | </a>
}

# Main TEMPLATE cObject for the BODY
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
    # Feeding the content from the Auto-parser to the TEMPLATE cObject:
  template =< plugin.tx_automaketemplate_pi1
    # Select only the content between the <body>-tags
  workOnSubpart = DOCUMENT_BODY
 
    # Substitute the ###menu### subpart with some example content:
  subparts.menu < temp.menu


   # Substitute the ###text### subpart with some example content:
  subparts.text < styles.content.get
}
 
 
# Main TEMPLATE cObject for the HEAD
temp.headTemplate = TEMPLATE
temp.headTemplate {
    # Feeding the content from the Auto-parser to the TEMPLATE cObject:
  template =< plugin.tx_automaketemplate_pi1
    # Select only the content between the <head>-tags
  workOnSubpart = DOCUMENT_HEADER
}
 
# Default PAGE object:
page = PAGE
page.typeNum = 0
 
# Copying the content from TEMPLATE for <body>-section:
page.10 < temp.mainTemplate
 
# Copying the content from TEMPLATE for <head>-section:
page.headerData.10  < temp.headTemplate


Der HTML-Code von Template_1.html sieht so aus:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
<!--
@import url("styles.css");

-->
</style>
</head>
<body>
<div id="menu">
<a href="datei1.html">Item1</a>
<a href="datei2.html">Item2</a>
</div>

<div class="text">
Hier steht etwas Text
</div>

<div class="text">
Und noch mehr Text
</div>

</body>
</html>


Die Marker werden dabei korrekt gesetzt. Alle DIVs sind markiert. Wo ist da 
der Fehler im Skript?

Stefan



More information about the TYPO3-german mailing list