how do i convert this

    <label for="category">Select Winner</label> <select name="willwin" id="willwin"> <?php
if ($db->numrows() > 0){
        while ($row = $db->fetch()) { ?> <option value=''></option> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php 
?> </select> <br/><br/> <label>Tag Bettor</label> <select name="sub_cat" id="sub_cat"></select>

into this

$TPL_team_list = '<select name="willwin" class="form-control">' . "\n";
        while ($row = $db->fetch())
            $TPL_team_list .= "\t" . '
            <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option value="' . $row['team1'] . '" ' . $selected . '>' . $row['team1'] . '</option> <option value="' . $row['team2'] . '" ' . $selected . '>' . $row['team2'] . '</option>
            ' . "\n";

        $TPL_team_list .= '</select>' . "\n";

cause i need this php form to work inside tpl file

Edited by david_105

1 Year
Discussion Span
Last Post by diafol

I think TPL stands for template file. I had to work in the past on an OpenCart webshop and that whole thing was build with.tpl files, but it was just PHP & HTML inside of these files.

Edited by gentlemedia

Votes + Comments
Here's hoping David can fill in the blanks.

yeah tpl is a template that doesnt seem to allow direct php codes in it


David, fill in the blanks about what language or system uses those tpl files. As it is, we're guessing. How about a link to the product page and docs? A lot of us write in many languages but we need a little more from you on this.


You allow server to use php within tpl, e.g. Apache

AddType application/x-httpd-php .tpl

Or you can use templating shortcuts within tpl files, e.g. Smarty, RainTPL, etc, etc.


tpl is a template that can be connected to php to act as its frontend display


Typically the files are used by templating engines or you can use native templating but seems a bit of a phaff if you're going native. Why not just give them a php extension?

Edited by diafol

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.