Zend - The PHP Company




Miscellaneous

Add Code


Write Generation I  

Type: code fragment
Added by: tgtRanCe
Entered: 20/02/2001
Last modified: 02/12/2000
Rating: - (fewer than 3 votes)
Views: 4397
Write is a simple editor for the web. It has a File list box on the left side and the editor textfield in the right side. The next step is to build a class module which generates automatically this editor.


<HTML>
<BODY>
<TABLE border="0" cellspacing="0" cellpadding="0">
<TR>
    <TD valign="top">
    <FORM method="post" action="write.php?action=open">
        <select name="lstFilename" size="5">
        <?
            $vDir 
dir("data/");
            while(
$entry=$vDir->read()) {
                if ( (
$entry != ".") && ($entry != "..") ) echo ("<option value="$entry">".$entry);
            }
            
$vDir->close();
              
?>
        </select><br>
        <input type="submit" value="Open...">
    </FORM>
    </TD>
    <TD valign="top">

    <textarea name="lstText" rows="25" cols="80"><?

        
if ($action == "open") {
            if ( 
$lstFilename && !empty($lstFilename) ) 
            {    
                
$v=File("data/".$lstFilename);
                for (
$i=0;$i<count($v);$i++) {
                    echo(
$v[$i]."n");
                }
            }
        }    
    
?></textarea>
    </TD>
</TR>
</TABLE>
        
</BODY>
</HTML>


Usage Example




Rate This Script





Search



This Category All Categories