fasttemplate with drop down box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • boyindie86
    New Member
    • Jun 2007
    • 31

    fasttemplate with drop down box

    HI

    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
    Code:
    <!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>
    Code:
    <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.FastTem plate.php");
    class getFile
    {

    public function getFile()
    {
    $this->TPL= $tpl;
    }


    public function getWords()
    {
    $this->TPL = new FastTemplate("./tpl");
    $this->TPL->define(array(" file_name"=>"ge tfile.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($_GE T['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_conten ts($file);
    $array = split(";",$text );
    for($i=0; $i<=count($arra y);$i++)
    {
    $this->TPL->assign(OPTIONS ,$array[$i]);
    $this->TPL->parse("LIST",w ord);
    }
    $this->TPL->parse(PAGE,fil e_name);
    $this->TPL->FastPrint(PAGE );
    }
    }
    }
    }
    }
    ?>[/PHP]
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    HOW 'BOUT SMARTY ?

    You're using a oblique class written by some fella that is not so popular.

    At times like this, If you can't ask the guy who wrote it, you're out of luck.

    Smarty, however, has an incredible manual and many people are familiar with it.

    Let us know what you decide,



    Dan

    Comment

    Working...