Feature #23853

Array in FLUIDTEMPLATE

Added by Stefan Froemken over 10 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-10-27
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

My TS:

page.100 = FLUIDTEMPLATE
page.100 {
  file = fileadmin/templates/fluid.html
  variables {
    myName = TEXT
    myName.value = Stefan Frömken

    customer = CONTENT
    customer {
      select {
        pidInList = 8
      }
      returnArray = 1 (This could be a new option)
      table = fe_users
    }
  }
}

My Template:
<html> <head> <title>FLUID-Template</title> </head> <body> <p>Hello: {myName}</p> <p>This are my customers</p> <ul> <f:for each="{customer}" as="daten"> <li>{daten.firstname} {daten.lastname}</li> </f:for> </ul> </body> </html>

Maybe there is a possibility to return Arrays in some cObjects.
(issue imported from #M16144)


Related issues

Related to TYPO3 Core - Task #43182: Split FLUIDTEMPLATE class to smaller methodsClosed2012-11-20

Actions
#1

Updated by Ernesto Baschny over 10 years ago

Nice idea, but will have to be postponed to 4.6. Thanks!

#2

Updated by Stefan Froemken over 10 years ago

no problem. I read in TYPO3-lists that there is less time and much to do to get 4.5 very cool :-)

#3

Updated by Xavier Perseguers almost 10 years ago

  • Category deleted (Communication)
  • Target version deleted (4.6.0-beta1)
#4

Updated by Christian Kuhn over 8 years ago

I have a similar issue:

if you have some TS like that for a extbase plugin:

plugin.tx_foo {
  persistence{
    ...
  }
  settings {
    foo = bar
    foobar.test = {$some constant}
  }
}

then, the extbase action controller assigns settings to the view automatically, it is available in fluid as {settings}. This feature is extremely useful!

I suggest to add a new setting to FLUIDTEMPLATE that does the same:

foo = FLUIDTEMPLATE {
  partialRootPath = {...}
  layoutRootPath = {...}
  variables {
    aCObj = TEXT
    aCObj.value = some text
    ...
  }
  settings {
    foo = bar
  }
}

#5

Updated by Gerrit Code Review over 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17849

#6

Updated by Gerrit Code Review over 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17849

#7

Updated by Gerrit Code Review over 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17849

#8

Updated by Christian Kuhn over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Eric Depta over 7 years ago

  • % Done changed from 100 to 0

What is that settings thing?
For me it looks like completly failed!
What about things like this:

page.100 = FLUIDTEMPLATE
page.100 {
file = fileadmin/templates/fluid.html
variables {
array {
0 < styles.content.get
1 < styles.content.getLeft
}
}
}

Template:

<f:for each="{array}" as="col">
<div class="col">{col}</div>
</f:for>

Also returning selects as array would be cool as suggested.

sorry cant fix the script layout...

#10

Updated by Stefan Neufeind about 7 years ago

@Eric: If you use "variables" everything is based on objects. For example you'll have to define a TEXT-object to pass through text to a Fluid-template. And all that you pass through to Fluid here is evaluated, there are no "values" passed or so. Fluid gets the final, generated output (text).
With "settings" you can pass through certain values unmodified and without any evaluation. This way you could for example pass

settings.person {
name = foo
pictureUrl = bar
}

through to Fluid and there decide about the output. You could use the pictureUrl (just a "string") to pass that as src to a f:image-ViewHelper.

#11

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF