[Typo3] Modern Template Building Part 2

Amy Thornton amy.thornton at usm.edu
Tue Nov 15 17:05:50 CET 2005


I am having some problems with the MTB Part 2 Tutorial.  I am trying to 
create the content are template but it is not working.  This is the code I 
have.  I have put the following in the setup for ext: CA TEMPLATE cObject:

# Content Area TEMPLATE cObject
temp.contentArea = TEMPLATE
temp.contentArea {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
# CREATES A COPY since we need to manipulate some properties!
template < plugin.tx_automaketemplate_pi1

# Reconfigurating the "tmplselect" plugin to select from the
# "content area templates " in sub/ folder instead of main templates:
template.content.templateType = sub
template.content.defaultTemplateFileName = ct_1.html

# Since the template files are now located in another path
# the relative prefix must be changed as well:
template.relPathPrefix = fileadmin/template/sub/

# Clears the "elements" property:
template.elements >
# Sets the DIV and TD elements to be wrapped in subparts:
# Wrap the header section but remove <title> and <style> sections:
template.elements {
HEAD.all = 1
HEAD.all.subpartMarker = DOCUMENT_HEADER
HEAD.rmTagSections = title, style

DIV.all = 1
TD.all = 1
}

# Select only the content of the <div id="contentsection"> element
workOnSubpart = contentsection
}

Then, I put the following in "NEW SITE" main template record:
# 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

TD.all = 1
}

# Prefix all relative paths with this value:
relPathPrefix = fileadmin/template/main/
}

# Menu 1 cObject
temp.menu_1 = HMENU
# First level menu-object, textual
temp.menu_1.1 = TMENU
temp.menu_1.1 {
# Normal state properties
NO.allWrap = <div class="menu1-level1-no"> | </div>
NO.stdWrap.htmlSpecialChars = 1
# Enable active state and set properties:
ACT = 1
ACT.stdWrap.htmlSpecialChars = 1
ACT.allWrap = <div class="menu1-level1-act"> | </div>
}
# Second level menu-object, textual
temp.menu_1.2 = TMENU
temp.menu_1.2 {
# Normal state properties
NO.allWrap = <div class="menu1-level2-no"> | </div>
NO.stdWrap.htmlSpecialChars = 1
# Enable active state and set properties:
ACT = 1
ACT.stdWrap.htmlSpecialChars = 1
ACT.allWrap = <div class="menu1-level2-act"> | </div>
}

# 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_1### subpart with dynamic menu:
subparts.menu_1 < temp.menu_1

# Substitute the ###content### subpart with some example content:
subparts.content < styles.content.get
subparts.content.value = HELLO WORLD - CONTENT
}

# 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
}

# Main TEMPLATE cObject for the HEAD / Content Area
temp.headTemplateCA = TEMPLATE
temp.headTemplateCA {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
template < temp.contentArea.template
# 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
# Copying the content from Content Area TEMPLATE for <head>-section:
page.headerData.20 < temp.headTemplateCA

plugin.tx_automaketemplate_pi1.content < plugin.tx_tmplselect_pi1
plugin.tx_automaketemplate_pi1.content.defaultTemplateFileName = 
template_1.html

Then, I put the following in the setup for "ext: Main TEMPLATE cObject":
# 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_1### subpart with dynamic menu:
subparts.menu_1 < temp.menu_1

# Substitute the ###menu_2### subpart with dymanic menu:
subparts.menu_2 < temp.menu_2

#Substitute the ###path### subpart with dynamic path menu:
subparts.path < temp.path

# Substitute the ###content### subpart with the content area template:
subparts.content < temp.contentArea
}

# 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

Has anyone been able to get the main template and the content area template 
to work together so that you can select which templates you would like to 
use through the page header?

I appreciate your time and help.  Thanks.

Amy Thornton, Electronic Services Specialist
Information Services, Cook Library
The University of Southern Mississippi
118 College Drive #5053
Hattiesburg, MS 39406-0001
Phone: (601) 266-6668
Fax: (601) 266-6857
E-mail: amy.thornton at usm.edu
http://www.lib.usm.edu/ 





More information about the TYPO3-english mailing list