user1335946
user1335946

Reputation: 108

Typoscript issue with Image Caption and Split

i'm in trouble with a challenge and can't find a solution since a day now.

renderObj = COA
renderObj {
    10 = TEXT
    10 {
        cObjNum = 1
        field = image
        split {
            token = ,
            cObjNum = |*| 10 || 20 |*|
            10.current = 1
            10.wrap = <li><a href="#"><img ref="uploads/pics/|" src=
            20.current = 1
            20.wrap = "uploads/pics/|" /></a><span>{CAPTION-GOES-HERE}</span></li>
        }
    }
}

As you can see I split the images, first is a jQuery object "ref" and the second is a Preview-Image. Now i need to get the caption of one of the two images, doesn't matter which.

I am really more than happy about every little hint i can get.

Thank you very much!

Upvotes: 1

Views: 1539

Answers (2)

maholtz
maholtz

Reputation: 3631

did not tested it, but i guess that should do the job.

renderObj = COA
renderObj {
    10 = TEXT
    10 {
        field = image
        split {
            token = ,
            cObjNum = 1
            1.current = 1
            1 {
              10 = TEXT
              10.value = <img ref="uploads/pics/{current:1}" src="uploads/pics/{current:1}" />
              10.insertData = 1
              10.wrap = <a href="#">|</a>
              20 = TEXT
              20.field = field_name_where_your_captions_are
              20.listNum.data = REGISTER:SPLIT_COUNT
              20.wrap  = <span>|</span>
              wrap = <li>|</li>
            }
        }
    }
}

Upvotes: 1

tmt
tmt

Reputation: 8614

It's a bit longer as I tried to divide it into logical structure and use IMG_RESOURCE objects even though they are not necessary in your case (though you would need it if you wanted to do some processing on those images in future).

renderObj = COA
renderObj {
  wrap = <li>|</li>

  10 = COA
  10 {
    wrap = <a href="#"><img|/></a>

    10 = IMG_RESOURCE
    10 {
      file {
        import = uploads/pics/
        import.field = image
        import.listNum = 0
      }
      stdWrap.noTrimWrap = | ref="|"
    }

    20 = IMG_RESOURCE
    20 {
      file {
        import = uploads/pics/
        import.field = image
        import.listNum = 1
      }
      stdWrap.noTrimWrap = | src="|" |
    }
  }

  20 = TEXT
  20 {
    field = imagecaption
    listNum = 0
    listNum.splitChar = 10
    wrap = <span>|</span>
  }
}

Upvotes: 0

Related Questions