[TYPO3] Saving the SPLIT_COUNT to a list

Koos Beens koosb at xs4all.nl
Thu Jun 19 14:20:00 CEST 2008


> <snip>
> SPLIT_COUNT does not contain the number of splits, but is incremented
> for each iteration of the split.
>
> -
> Peter Klein
> <snip>

I understand that. There is a div wrapped around the thumbs. That div gets
a unique id using register:SPLIT_COUNT. For example I got 19 images. That
executes that part twice. And results in two divs, one with id="section0"
and one with id="section12" Now I'd like to save the id's, or at least the
SPLIT_COUNT at this point. This way I can refer to these id's elsewhere on
the page.

I've tried a lot. My current typoscript is the following. Problem is that
the register is not set, it stays empty.

#Standard wrapping of every image
tmp.imgWrap = COA
tmp.imgWrap {
	10 = IMAGE
	10.file.import.dataWrap = fileadmin/images/work/{field:field_subdir}/thumbs/
	10.file.import.current = 1
	10.stdWrap.typolink.parameter.dataWrap =
fileadmin/images/work/{field:field_subdir}/full/{current:1}
	10.stdWrap.typolink.ATagParams.dataWrap =
onclick="Images.loadDetail('fileadmin/images/work/{field:field_subdir}/full/{current:1}');return
false;"  target="_blank"

	20 = HTML
	20.value.char = 10
}

lib.kzyGallery = COA
lib.kzyGallery {

	# Here I would like to save a list of the SPLIT_COUNT number of the first
split (1)
	menuSplits = TEXT
	# For testing
	menuSplits.value = empty

	# Returns the thumbnails
	thumbs = COA
	thumbs {
		10 = TEXT
		10.filelist = fileadmin/images/work/{field:field_subdir}/thumbs | png |
date |
		10.filelist.insertData = 1

		# Save the list of images and the first image. The full list
		first = COA
		first {
			10 = LOAD_REGISTER
			10 {
				allImages < lib.kzyGallery.thumbs.10

				firstImage < lib.kzyGallery.thumbs.10
				firstImage.listNum = 0
			}

			20 = IMAGE
			20 {
				file.import.dataWrap =
fileadmin/images/work/{field:field_subdir}/full/{register:firstImage}
				params = id="image_full"
			}
		}

		10.split {
			token = ,
			cObjNum = |*| 1 || 2 || 2 || 2 || 2 || 2 || 2 || 2 || 2 || 2 || 2 || 3 |*|

    		1 {
			# This creates a div with for example id=section0 and id=section12 etc.
I'd like to save this '0' and '12' to a list...
	    		10 < tmp.imgWrap
	    		10.wrap = <div class="section" id="section{register:SPLIT_COUNT}">|
	    		10.append = LOAD_REGISTER
			10.append.listOfIds = TEXT
			10.append.listOfIds.current = 1
			# Both do not result in a value available at the end
			# 10.append.listOfIds.value = test123
			# 10.append.listOfIds.dataWrap = |,{register:SPLIT_COUNT}

			# Maybe this
			# lib.kzyGallery.menuSplits.value.dataWrap = |,{register:SPLIT_COUNT}

			# This doesn't work
			# 30 =< lib.kzyGallery. menuSplits
			# 30.value := addToList(blas, test)

			# This doesn't work
			# lib.kzyGallery.menu = addToList(blas, test)
    		}
    		1.insertData = 1

		2 < tmp.imgWrap

		3 < tmp.imgWrap
		3.wrap = | </div>

		}

		# Because the last image is not wrapped we need to add the closing div.
This might give problems when the
		# number of images is a multiple of 12. Not sure. Will need to look into
optionSplit a bit more...
		10.wrap = |</div>

		# Wrap the whole again
		10.wrap2 = <div class="scroller-content">|</div>
	}
}

# The scripts will be inserted only if there are images
page.headerData.99 = HTML
page.headerData.99 {
	value (
		<script src="fileadmin/javascripts/application.js"
type="text/javascript"></script>
		<script src="fileadmin/javascripts/scriptaculous/lib/prototype.js"
type="text/javascript"></script>
		<script src="fileadmin/javascripts/scriptaculous/src/scriptaculous.js"
type="text/javascript"></script>
		<script src="fileadmin/javascripts/glider.js"
type="text/javascript"></script>

		<script type="text/javascript">
		document.observe("dom:loaded", function() { var my_glider = new
Glider('my-glider', {duration:0.5}); });
		</script>

	)
	value.if.isTrue.data = register:allImages
}







More information about the TYPO3-english mailing list