TouchofDestiny
TouchofDestiny

Reputation: 25

Typoscript : Condition on IMAGE Content Object

I have this code:

customers = CONTENT
                customers {
                    table = tx_nmshowroom_customers
                    select {
                        pidInList = {$plugin.tx_nmshowroom_pi1.pid.showroomData}
                        recursive = 10
                        where = FIND_IN_SET(uid, ###CUSTOMERSLIST###)
                        markers {
                            CUSTOMERSLIST.field = tx_nmshowroom_customers
                        }
                    }


                    customersList = COA
                    customersList {

                        10 = HTML
                        10.value.field = name
                        10.value.typolink{
                                    parameter = {$plugin.tx_nmshowroom_pi1.pid.customersDetailView}
                                    additionalParams = &tx_nmshowroom_pi1[customeruid]={field:uid}
                                    additionalParams.insertData = 1
                        }

                        10.stdWrap {
                            wrap = <p class='list'>|</p>
                            required = 1
                        }

                    }

                    renderObj < .customersList
                    renderObj.stdWrap {
                            wrap = <div class='label'><p>Auftrag:</p></div><div>|</div>
                            required = 1
                    }       

                }

The select can also return no value, that means that no record is found.

In this case I would like to replace the customers Object with a text or with another IMAGE.

The problem is, that I don't know how to write the condition on "customers":

customers.override.if..... No idea at all.

Can anybody help me?

Thank you very much in advance. Davide

Upvotes: 0

Views: 878

Answers (2)

maholtz
maholtz

Reputation: 3631

I would suggest this solution:

customers.stdWrap.ifEmpty = Sorry, there is no content here

Of if you need an content object:

customers.stdWrap.ifEmpty.cObject = TEXT
customers.stdWrap.ifEmpty.cObject.value = Sorry, there is no content here

Upvotes: 2

tmt
tmt

Reputation: 8614

customers = COA
customers {
  10 = CONTENT
  10 {
    table = tx_nmshowroom_customers
    select {
      pidInList = {$plugin.tx_nmshowroom_pi1.pid.showroomData}
      recursive = 10
      where = FIND_IN_SET(uid, ###CUSTOMERSLIST###)
      markers {
        CUSTOMERSLIST.field = tx_nmshowroom_customers
      }
    }

    renderObj = COA
    renderObj {
      10 = HTML
      10 {
        value.field = name
        value.typolink{
          parameter = {$plugin.tx_nmshowroom_pi1.pid.customersDetailView}
          additionalParams = &tx_nmshowroom_pi1[customeruid]={field:uid}
          additionalParams.insertData = 1
        }

        stdWrap {
          wrap = <p class='list'>|</p>
          required = 1
        }
      }

      wrap = <div class='label'><p>Auftrag:</p></div><div>|</div>
      required = 1
    }
  }

  20 = TEXT
  20 {
    if.isFalse.numRows < customers.10
    value = [substitute content]
  }
}

Upvotes: 0

Related Questions