View previous topic :: View next topic |
Author |
Message |
Aar Smarty Rookie
Joined: 19 Jul 2011 Posts: 12
|
Posted: Tue May 03, 2016 5:06 pm Post subject: Fill HTML-tables vertically with Smarty |
|
|
I have this table, and i have a question about it.
Code: |
<table>
<tbody><tr>
<th> </th>
<th>mo</th>
<th>tu</th>
<th>we</th>
<th>th</th>
<th>fr</th>
<th>sa</th>
<th>su</th>
</tr>
<tr>
<td>min. temp</td>
<td>10</td>
<td>9</td>
<td>8</td>
<td>8</td>
<td>12</td>
<td>11</td>
<td>13</td>
</tr>
<tr>
<td>max. temp<br></td>
<td>18</td>
<td>17</td>
<td>15</td>
<td>16</td>
<td>18</td>
<td>17</td>
<td>19</td>
</tr>
<tr>
<td>weather</td>
<td>sunny</td>
<td>rain</td>
<td>sunny<br></td>
<td>cloudy</td>
<td>clear view</td>
<td>rain</td>
<td>cloudy</td>
</tr>
</tbody></table>
|
Now i'm curious how can i fill this table vertically with data. This is a weather-forecast table.
My array is:
Code: |
[0] => Array
(
[time] => 1462226400
[summary] => Lichte regen gedurende de ochtend.
[icon] => rain
[sunriseTime] => 1462248380
[sunsetTime] => 1462302536
.....
)
[1] => Array
(
[time] => 1462312800
[summary] => Licht bewolkt gedurende de avond.
[icon] => partly-cloudy-day
[sunriseTime] => 1462334669
[sunsetTime] => 1462389037
.......
)
[2] => Array
(
[time] => 1462399200
[summary] => Licht bewolkt gedurende de nacht.
[icon] => partly-cloudy-night
[sunriseTime] => 1462420961
[sunsetTime] => 1462475538
...........
)
|
Anyone an idea how i can solve this in Smarty? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
Aar Smarty Rookie
Joined: 19 Jul 2011 Posts: 12
|
Posted: Tue May 03, 2016 6:34 pm Post subject: |
|
|
Thanks.... but how can i implement this in Smarty? |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
|
Back to top |
|
Aar Smarty Rookie
Joined: 19 Jul 2011 Posts: 12
|
Posted: Tue May 03, 2016 9:24 pm Post subject: |
|
|
I tried it, but it gives a:
Fatal error: Call-time pass-by-reference has been removed
By removing the ampersand (&) the function doesn't works anymore. How can i make this work in PHP 5.5? On PHP 5.3 en lower, this works perfectly.
What now? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue May 03, 2016 9:49 pm Post subject: |
|
|
Aar wrote: | Thanks.... but how can i implement this in Smarty? |
You don't need to implement it in Smarty.
You need to implement it in PHP.
And only pass to Smarty the data prepared for display. |
|
Back to top |
|
Aar Smarty Rookie
Joined: 19 Jul 2011 Posts: 12
|
Posted: Tue May 03, 2016 10:08 pm Post subject: |
|
|
AnrDaemon wrote: | Aar wrote: | Thanks.... but how can i implement this in Smarty? |
You don't need to implement it in Smarty.
You need to implement it in PHP.
And only pass to Smarty the data prepared for display. |
Thanks, i have figured this out, but the function is not working on the recent PHP version, because the ampersand. What now? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed May 04, 2016 12:51 am Post subject: |
|
|
What function?… |
|
Back to top |
|
Aar Smarty Rookie
Joined: 19 Jul 2011 Posts: 12
|
Posted: Wed May 04, 2016 6:33 am Post subject: |
|
|
AnrDaemon wrote: | What function?… |
On the Github page. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed May 04, 2016 6:18 pm Post subject: |
|
|
Then you failed to understand my answer. |
|
Back to top |
|
|