[Typo3] Print Page with Autoparser

Peter Russ peter.russ at 4dfx.de
Thu Feb 3 20:54:26 CET 2005


Marlies C schrieb:
> Ok, I have narrowed it down to what it want to be able to do. I have my 
> pages already setup so that when you want to print them, the print dialog 
> box will open and it will print only the content and no navigation. Good so 
> far.
> 
> But what I want, is to see a page in the browser that looks like what you 
> get when you print it out. How do I set this up with the Autoparser. What 
> used to work before the Autoparser gives me now an
>      Error! The page is not configured! [type= 98][] message.
> 
> How can I fix this?
> 
> Thanks
> 
> Marlies
> www.mcuniverse.com
> 
> 
^
1) in CONSTANT setup the template e.g.:
#Autoparser
CONTENTFILE=fileadmin/tpl/icp/tpl.icp.001.html
REL_PATH_PREFIX=fileadmin/tpl/icp/
[globalVar = TSFE:type=98,GP:fdfxpx=1]
#PRINTING
     CONTENTFILE=fileadmin/tpl/icp/tpl.print.html
[end]

2) SETUP the auto-parser to your needs
# Configuring the Auto-Parser:
plugin.tx_automaketemplate_pi1 {
     # Read the template file:
     content = FILE
     content.file = {$CONTENTFILE}
     # 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
         DIV.all=1
     }
     # Prefix all relative paths with this value:
     relPathPrefix= {$REL_PATH_PREFIX}
     relPathPrefix.A = /
}

3) Instruction for printing in SETUP
#Printlink
temp.PRINT = IMAGE
temp.PRINT{
     file = {$MAIN.IMAGE.HEADER.PRINT}
     params=id="{$alt_print_SWAP_IT}"
     stdWrap.postUserFunc = tx_make_printlink
     stdWrap.postUserFunc{
         include_post_vars = 1
         target = _blank
         popup = 1
         swapIt= {$alt_print_SWAP_IT}
//one line
         windowparams 
=resizable=yes,toolbar=no,scrollbars=yes,menubar=no,width=720,height=500

     }
}
[globalVar = TSFE:type=98]
temp.mainTemplate {
    workOnSubpart = DOCUMENT_BODY
     #Substitute markers
     marks {
		__FDFX_BM_PATH.1.NO.doNotLinkIt=1
         PAGE_TITLE = TEXT
         PAGE_TITLE.field = title
         PAGE_SUBTITLE = TEXT
         PAGE_SUBTITLE.field = subtitle
         PAGE_AUTHOR = TEXT
         PAGE_AUTHOR.field = author
         PAGE_AUTHOR.required=1
         PAGE_AUTHOR.typolink.parameter.field = author_email
         PAGE_UID = TEXT
         PAGE_UID.field = uid
         PRINT_ICON < temp.PRINT
         CONTENT < styles.content.get
     }
}
[else]
temp.mainTemplate {
    workOnSubpart = DOCUMENT_BODY
     #Substitute markers
     marks {
         PRINT_ICON < temp.PRINT
     }
}
[end]
#Print Page
alt_print >
alt_print = PAGE
alt_print{
     headerData.10  < temp.headTemplate
     typeNum=98
     bodyTag=<body onload="window.print()">
     10 < temp.mainTemplate
}

Works for me.

Regs. Peter.



More information about the TYPO3-english mailing list