[TYPO3] Include reference to external javascript file

Andrew Davis andrew at theandrewunderground.com
Sat Dec 2 03:24:53 CET 2006


dimitry, where should this code go if i am using automaketemplate for my 
template? Im trying to make a link to some js for a rollover imageswap 
functionality that is being stripped out of the template when it parses...

any help much appreciated!
Andrew Davis

> 
> Try something like this:
> 
> page.headerData.100 = TEXT
> page.headerData.100.value = script type="text/javascript
> src="fileadmin/templates/scripts/menu.js"></script
> page.headerData.100.wrap = <|>
> 


my template


# REAL URL SETUP ############
#Real URL doesnt work with static documants!
config.simulateStaticDocuments = 0
#Needs to be root of the site prefixed with http:// !!
config.baseURL = ...
#enable the plugin - add code to .htaccess too!
config.tx_realurl_enable = 1
# Fix for named anchors
config.prefixLocalAnchors = all


# Configuring the Auto-Parser for main template: ######

plugin.tx_automaketemplate_pi1 {

   // Read the template file:

   content = FILE

   content.file = fileadmin/template/home.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 TEMPLATE cObject for the HEADER ####################################

temp.headerTemplate = TEMPLATE

temp.headerTemplate {
	template =< plugin.tx_automaketemplate_pi1	
	workOnSubpart = DOCUMENT_HEADER
}



# Menu 1 cObject #############################################
temp.menu_1 = HMENU


   # First level menu-object, textual
temp.menu_1.1 = TMENU
temp.menu_1.1.wrap = <ul> | </id>
temp.menu_1.1 {

     # Expand all menus 1=yes 0=no
     expAll = 0

    # Normal state properties
   NO.allWrap = <li class="menu1-level1-no"> | </li>
   NO.stdWrap.htmlSpecialChars = 1

    # Enable active state and set properties:
   ACT = 1
   ACT.allWrap = <li class="menu1-level1-act"> | </li>
   ACT.stdWrap.htmlSpecialChars = 1

}

   # Second level menu-object, textual
temp.menu_1.2 = TMENU
temp.menu_1.2 {

    # Normal state properties
   NO.allWrap = <li class="menu1-level2-no"> | </li>
   NO.stdWrap.htmlSpecialChars = 1

    # Enable active state and set properties:
    ACT = 1
   ACT.allWrap = <li class="menu1-level2-act"> | </li>
   ACT.stdWrap.htmlSpecialChars = 1

}


# Main TEMPLATE cObject for the BODY ####################################

temp.bodyTemplate = TEMPLATE

temp.bodyTemplate {

     # 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:
   subparts.menu_1 < temp.menu_1

   	#subparts.navpath < plugin.tx_jullenavpath_pi1

	#Left subparts
   subparts.leftcolumn < styles.content.getLeft

     # Substitute the ###content### subpart:
   subparts.content < styles.content.get

   #subparts.border < styles.content.getBorder
   	

}




# Default PAGE object: ####################################
page = PAGE
page.typeNum = 0
page.config.doctype = xhtml_trans
# Copying the content from TEMPLATE for <body>-section:
page.10 < temp.bodyTemplate
page.10.headerData < temp.headerTemplate

page.stylesheet = fileadmin/template/css/style_main.css


More information about the TYPO3-english mailing list