user500665
user500665

Reputation: 1362

Get an image from a UID using typoscriptObjectPath in a Fluid template?

In my Fluid template I have a uid of a category. How can I get an image from a field on that category?

I've tried <f:cObject typoscriptObjectPath="lib.catImage" data="{myuid}" />

Then something like:

lib.catImage = CONTENT
lib.catImage {
    table = sys_category
    current = 1
    select {
        fieldName = cat_image
    }
    renderObj {
        ???
    }
}

Upvotes: 0

Views: 735

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2577

You don't want to get CONTENT but FILES:

lib.catImage = FILES
lib.catImage {
  maxItems = 1
  references {
    table = sys_category
    uid.data = field:uid
    fieldName = images
  }

  renderObj = TEXT
  renderObj {
    stdWrap.data = file:current:uid
  }
}

And call it via <f:cObject typoscriptObjectPath="lib.catImage" data="{uid: {myuid}}" />

Upvotes: 1

Related Questions