I have a small school project which I've almost finished. But now I have to change my working code and use template instead. I chose Smarty. Table displays data from a form. Data is stored in the text file and each element is on new line. Everything worked before but now that I can't figure out how to how to display my table. With my current code, my page turns white. I debugged it and got an error "is deprecated, use SmartyBC class to enable". I tried setting new smarty, I also tried using template function (plugin) but I still get white page. Any suggestions would be appreciated! My table.php code: ($items function reads from the file)
<?php
$count = 0;
if (isset($Items)){
    foreach ($Items as $item) {
        if($count == 0){
            print "<tr><td>$item</td>";
            $count += 1;
        } else if($count == 1) {
            print "<td>$item</td>";
            $count +=1;
        } else if($count == 2) {
            print"<td>$item</td></tr>";
            $count = 0;
        }
    }
}
tpl file
    <table>
    <tr>
        <th>Name</th>
        <th>Lastname</th>
        <th>Phone</th>
    </tr>
    {include_php file='table.php'}
</table>
Edit: I used $smarty = new SmartyBC(); and changed to {php} tags. It no longer shows white screen but the table.php code doesn't work -the table doesn't show.
Is there a smarter way to do this? Other than including php file? Edit: I got it working by using foreach loop inside the tpl but I wonder if it's the right way to do this?
 
     
    