[TYPO3-english] Concatenation of a List with TypoScript

bernd wilke t3ng at bernd-wilke.net
Tue Mar 24 10:21:48 CET 2015


Am 24.03.15 um 09:19 schrieb Scotty C:
> Hi everyone,
> I need to build a "super <A> tag" to use in a fancybox like this:http://jsfiddle.net/kmLWf/260/
> The problem is, I need to build the HTML dynamically from a directory of files
>   Here's what I need specifically:
 > 1.) Traverse directory/folder for file names
 > 2.) Clean up the file name and use that as the "title" parameter
 > 3.) Use the file name with an IMAGE object and link to the full size 
image
 > 4.) Use the file name with an IMAGE object, shrink it to a thumbnail
 > put it in an <img> tag
 > 5.) Put it all together into one giant <a> tag
> Here's my mess so far:
> # Reference:
> # http://typo3.3.n7.nabble.com/TYPO3-english-List-of-files-from-a-directory-with-TS-td114707.html

temp.title = TEXT
temp.title {
	# *** grab all files
	filelist = fileadmin/templates/education||name
	# *** split up the results from above - see php explode()
	split {
		# search for comma delimiter
		token = ,
		# no idea what this does
		cObjNum = 1
		# wrap object in a TEXT block to apply functions to it
		1 = TEXT
		1 {
			# no idea what this does
			current = 1
			# extract everything but the .jpg
			substring = 0, -4
			# convert _ to " "
			replacement.10 {
				search = _
				replace = &#160;
				useOptionSplitReplace = 1
			}
			# outputs (ex) "title=chalk board"
			wrap = title="|"
		}
		# end 1
		# output <img src="chalk_board.jpg" width="200">

		2 = IMAGE
		2 {
			file = ????
			width = 200
		}
		# end 2
	}
	# end split
	# TODO: join up 1 and 2  # ????
}
# end temp.title
>
>
> Of course this is easy with PHP. But as for TS ... Each piece of what I need is documented, but put together ... I'm lost.
> Thanks as always,-Scott.
>

'no idea what this does' is a hint to study the manual.

I think you do not know what .split can do and what it does for you.
But also I think you are on the correct way, but need some more 
understanding of '.split', cObjNum, maybe optionsplit

you may get some more hints in this example, so it is in german: 
http://pi-phi.de/343.html

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list