[TYPO3] Howto include external HTML fragments?

Michael Cannon michael at cannonbose.com
Sun Feb 26 18:07:47 CET 2006


Considering that you probably have external scripts to grab data from  
your Access system that pretties up the result. You could use  
TypoScript to include an external script, then during template  
generation for that page, call a class method from that include.

I use includeLibs for integrating phpAdsNew with Typo3. Send end  
result of below at http://www.NewOrleansMagazine.com/. This method  
has been in production for about 2 years on over half-a-dozen websites.

user_ad.php is just a class wrapper for calling the procedural code  
of phpAdsNew. When Typo3 includes this file, Typo3 instantiates  
user_ad because of the user_ prefix on the class name. Search for  
user_ in the Typo3 docs for more details on why this works. Next,  
when my template is being created per the TypoScript below, when an  
ad zone needs to be generated, the show_ad method is called and the  
TypoScript data other than userFunc is passed to show_ad as $conf.

You can grok the remaining code to figure out that $conf is broken  
into minor parts for calling the phpAdsNew view_ad.


phpAdsNew Scripts
-----
http://cvs.cannonbose.com/cgi-bin/viewcvs.cgi/typo3/scripts/


TypoScript Setup
-----
includeLibs.ads = fileadmin/scripts/user_ad.php

todaysDate = USER
todaysDate {
	userFunc = user_todaysDate
}

# # Main TEMPLATE cObject for the BODY
other.body = TEMPLATE
other.body {
	# 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 ###nav-content### subpart with some example content:
	subparts.nav-main < other.nav-main
	subparts.nav-right < other.nav-right
	subparts.nav-footer < other.nav-footer
	subparts.nav-header < other.nav-header
	subparts.content-main < styles.content.get
# 	subparts.content-left < styles.content.getLeft
  	subparts.content-right < styles.content.getRight
	subparts.content-border < styles.content.getBorder

	subparts.todaysDate = TEXT
	subparts.todaysDate < todaysDate

	# current issue spotlight
	subparts.content-current-issue < styles.content.getLeft
	subparts.content-current-issue.select.pidInList = 685
	subparts.content-current-issue.select.uidInList = 715

	subparts.content-nav < styles.content.getLeft
	subparts.content-nav.select.pidInList = 1076

	subparts.content-right-ads < styles.content.getRight
	subparts.content-right-ads.select.pidInList = 1076

	subparts.ad-right-top = USER_INT
	subparts.ad-right-top {
		userFunc = user_ad->show_ad
		zone = 52
		target = _nohl
		source = NOHL
	}
	subparts.ad-right-middle = USER_INT
	subparts.ad-right-middle {
		userFunc = user_ad->show_ad
		zone = 54
		target = _nohl
		source = NOHL
	}
	subparts.ad-right-bottom = USER_INT
	subparts.ad-right-bottom {
		userFunc = user_ad->show_ad
		zone = 55
		target = _nohl
		source = NOHL
	}
	subparts.ad-header = USER_INT
	subparts.ad-header {
		userFunc = user_ad->show_ad
		zone = 53
		target = _nohl
		source = NOHL
	}
}
------



Michael

-----
Michael Cannon
President of Cannonbose, LLC
Tel    : +1 (206) 351-0159         Fax : +1 (802) 609-2776






More information about the TYPO3-english mailing list