Search code examples
phpfat-free-framework

Dynamic Parameter in fat free template roue


I have the following duplicate code in layout

<repeat group="{{ @devices }}" value="{{ @device }}">
  <tr>
    <td>
      <a href="{{ 'net_device', 'id={{ @device.id }}' | alias }}">Click Me</a>
    </td>
  </tr>
</repeat>

my routing are like below

GET @net_device:/net/device/@id=App\Controllers\DeviceController->show

there was an error in output

syntax error, unexpected 'id' (T_STRING), expecting ')' [D:\projects\lite\public\tmp\29ldv0dewydc0.imz2yj19ml3t.php:26]

How to add dynamic values for @id?


Solution

  • Try '@id='[email protected]. You can look at the generated template file 29ldv0dewydc0.imz2yj19ml3t.php from your error message and see what’s up.