[TYPO3] Auto-parser problem

Jasper jasper22 at xaker.ru
Sat Jan 7 13:28:47 CET 2006


This is the script:


# Configuring the Auto-Parser -----------------------------------------
plugin.tx_automaketemplate_pi1 {
     # Read the template file:
   content = FILE
   content.file = fileadmin/templates/main/index.html

    elements {
     BODY.all = 1
     BODY.all.subpartMarker = TEMPLATE_BODY

     HEAD.all = 1
     HEAD.all.subpartMarker = DOCUMENT_HEADER
     HEAD.rmTagSections = title

     TD.all = 1
    }

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

# 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 ------------------------------------------------------
temp.mainTemplate = TEMPLATE
temp.mainTemplate {

    # Feeding the content from the Auto-parser to the TEMPLATE cObject:
    template =< plugin.tx_automaketemplate_pi1

#   workOnSubpart = DOCUMENT_BODY

    #Menu on the left
    subparts.menu_left < temp.leftMenu

    # Insert content
    subparts.content < styles.content.get
}


# Default PAGE object ------------------------------------------------
page = PAGE
page.typeNum = 0

page.10 < temp.mainTemplate
page.headerData.10 < temp.headTemplate

^^^-  This is a regular part except I commented WorkOnSubpart


* Nothing in 'constans' section


Here is the output (view-source on page)

<!DOCTYPE html
	PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<!--
	This website is brought to you by TYPO3 - get.content.right
	TYPO3 is a free open source Content Management Framework created by 
Kasper Skaarhoj and licensed under GNU/GPL.
	TYPO3 is copyright 1998-2005 of Kasper Skaarhoj. Extensions are 
copyright of their respective owners.
	Information and contribution at http://www.typo3.com
-->


	
	<link href="fileadmin/templates/main/template.css" rel="stylesheet" 
type="text/css">

	<title>Jasper Home page: Root</title>
	<meta name="generator" content="TYPO3 3.8 CMS"
.
(cuted here some regulat stuff that TYPO insert)
.
</head>
<body bgcolor="#FFFFFF">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><!--###DOCUMENT_HEADER### begin -->
	
	<link href="fileadmin/templates/main/template.css" rel="stylesheet" 
type="text/css">
<!--###DOCUMENT_HEADER### end --></head>
<body><!--###DOCUMENT_BODY### begin -->
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
	<td rowspan="10" width="50%" height="100%" 
background="fileadmin/templates/main/images/bg1222.jpg" 
style="background-position:right top; background-repeat:repeat-y"></td>

	<td rowspan="10" width="1" bgcolor="#000000"></td>
	<td colspan="4">
	<table cellpadding="0" cellspacing="0" border="0">
.
(cuted here some text from HTML)
.
</tr>
	</table>
	<!--###DOCUMENT_BODY### end --></body>
	<td valign="top" width="59" height="100%" 
background="fileadmin/templates/main/images/l02.gif"><img 
src="fileadmin/templates/main/images/right.gif">
         </td>

</tr>
<tr>
	<td colspan="4" id="footer"><!--###footer### begin -->
		<table cellpadding="0" cellspacing="0" border="0">
			<tr>
.
(cuted here some text from html)
.
			</tr>
		</table>
	<!--###footer### end --></td>
	</tr>
</table>

</body>   <--- Actually close <body> tag

</html>

</body>

</html>


As you can see:
1) The txt/css link inserted correctly in TYPO <head> section and even 
correct path is present

2) For some strange reason I have <html>,<head>,<body> tags twice (!) - 
it's like my template wraped in TYPO <body> template althought that 
auto-parser correctly inserted all ###tag### comments and I can even 
build an menu and insert content at subpats.MyContentTag
   I can fix it by un-commenting the workOnSubparts in temp.mainTemplate 
section

3) Within the template it inserted at 2/3 position -> it's inserted 
automaticly - thereś no </body> tag there and not even something similar



Onno Schuit wrote:
> Hi Jasper,
> 
> 
> Exactly what TypoScript do you use to work on the body tag? What you've 
> shown us, is how you mark the body tag (namely, with 'DOCUMENT_BODY').
> 
> But you should also have something like:
> 
> 
> ### <TypoScript code snippet>
> 
> 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
> 
> ### </TypoScript code snippet>
> 
> 
> Hope this is enough of a hint. If not, please show us your entire 
> TypoScript code, so maybe we can pinpoint the problem.
> 
> 
> Cheers,
> Onno
> 
> 
> 
> 
> Jasper wrote:
> 
>>
>>   Hi !
>>
>>   Maybe someone can help me out here - I'm completly lost :(
>>
>>   Somehow auto-parser doesn't parse/see the whole template. When I 
>> pass the template to auto-parser like this:
>>
>> plugin.tx_automaketemplate_pi1 {
>>     # Read the template file:
>>   content = FILE
>>   content.file = fileadmin/templates/main/index.html
>>
>> and command to wrap the BODY tag
>>
>>   elements {
>>     BODY.all = 1
>>     BODY.all.subpartMarker = DOCUMENT_BODY
>>
>> somehow (this is a part that I can not understand) the <body> tag 
>> inserted at 2/3 of the original html file -> WOW and then I have about 
>> 1/3 of html text until actually close body tag </body>
>>
>>   Is thereś some kinda page-size limit ? or something ?
>>
>>
>> This is a 'view-source' from this page:
>>
>> .
>> .
>> .
>>         </tr>
>>     </table>
>>     <!--###DOCUMENT_BODY### end --></body>
>>     <td valign="top" width="59" height="100%" 
>> background="fileadmin/templates/main/images/l02.gif"><img 
>> src="fileadmin/templates/main/images/right.gif">
>>         </td>
>> </tr>
>>
>> <tr>
>>     <td colspan="4" id="footer"><!--###footer### begin -->
>>         <table cellpadding="0" cellspacing="0" border="0">
>>             <tr>
>> (cuted some text here)
>>         </table>
>>     <!--###footer### end --></td>
>>     </tr>
>> </table>
>> </body>   <--- Here Actually body tag !!!!!!!!!!!
>> </html>
>>
>>
>> As you can see for some strange reasong the </body> tag just inserted 
>> at the 2/3 of html page. On the other hand I see that "footer" class 
>> TD tag correctly wraped
>>
>> What I can do about ? What is the problem ?
>>



More information about the TYPO3-english mailing list