[TYPO3-english] Concatenation of a List with TypoScript

Scotty C superscotty19 at yahoo.com
Wed Mar 25 06:55:50 CET 2015


Bernd,
... :-O ....
That cheat sheet web site of yours is AMAZING!!!
And, OptionSplit! I completely forgot about that. In fact, there's many techniques in your code that I didn't even know existed. I've been using TYPO3 for over a decade, I bought every book, and I studied the "split" documentation to the letter before emailing. I firmly believe this is the best CMS in the world *by far*, but when my computer science degree and the aforementioned resources lead me to see the innards like a foreign language ... well, it's not hard to see why exploit-a-day WordPress is gaining so much ground.
Anyway, I implemented the code really quick and it worked perfectly - I'll be studying/modifying it over the next few days and I'll post my stuff.
The list does it again ... Thank you!-Scott.

 
      From: bernd wilke <t3ng at bernd-wilke.net>
 To: typo3-english at lists.typo3.org 
 Sent: Tuesday, March 24, 2015 3:21 AM
 Subject: Re: [TYPO3-english] Concatenation of a List with TypoScript
   
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 =  
                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
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english


   


More information about the TYPO3-english mailing list