I am trying to build a page using the fasttemplate class.
I am having problems getting it to populate a drop down menu using the templating
I read words from a text file and I read them into array, which I loop around and set to the template
all i am gettin is multiple drop down boxes being printed out, with a single word in each
anyhelp would be greatly appreciated
cheers
boyindie
here is my html
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Forum Engine</title>
- </head>
- <body>
- <div id="contentdiv">
- <table border="0" id="tblWords">
- <tr>
- <td>
- {LIST}
- </td>
- <td align="center" valign="middle">
- <image />
- <br />
- <image src2();"/>
- </td>
- <td>
- <select id="acceptWords" name="sel2" size="10" multiple="multiple"></select>
- <input type="button" value="Create Links" onClick="createLinks();">
- </td>
- </tr>
- </table>
- </div>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- <select id="wordlist" name="sel1" size="10" multiple="multiple">
- <option value="{OPTIONS}">{OPTIONS}</option>
- </select>
and my PHP code is as follows
[PHP]<?php
include_once ("class.FastTemplate.php");
class getFile
{
public function getFile()
{
$this->TPL= $tpl;
}
public function getWords()
{
$this->TPL = new FastTemplate("./tpl");
$this->TPL->define(array("file_name"=>"getfile.html",
"word" =>"table_Words.tpl.html"));
// Get URL and div
if (!isset($_GET['file']))
{
echo "File not specified.";
}
else
{
if (!isset($_GET['url']))
{
echo "url not specified to return to";
}
else
{
$file =urldecode($_GET['file']);echo"<br>";
$url = urldecode($_GET['url']);
if (substr($url, 0, 4) != 'http')
{
// Set error
echo 'Invalid File - '.$file;
return false;
}
else
{
$text = file_get_contents($file);
$array = split(";",$text);
for($i=0; $i<=count($array);$i++)
{
$this->TPL->assign(OPTIONS,$array[$i]);
$this->TPL->parse("LIST",word);
}
$this->TPL->parse(PAGE,file_name);
$this->TPL->FastPrint(PAGE);
}
}
}
}
}
?>[/PHP]