Location: PHPKode > projects > noticeboard > noticeboard/list_edit.html

include  ('template.inc');
include  ('variable.inc');

* Nanou Morgan                  Web  			http://www.vmedia.com.au            
* NoticeBoard version 1.1		Personal Web	http://www.nanou.com.au
* January 2001					Email: 			hide@address.com


$mylist = file ($cat_file);
$title= "Modify The Category list";

if ($submit == ""){

		<INPUT TYPE='hidden' NAME='list' VALUE='$list'>
		<P ALIGN='CENTER'><FONT FACE='Arial' color='blue'>
		<B>This is the current Category list.<br>
		Type in a new item or modify the text <br>
		in the box and press the \"Update List\" button</B></FONT><br><br>
		<FONT FACE='Arial' color='red'>WARNING: Do not leave extra spaces after each line<br>
		Also use and instead of the symbol &amp;
		<TR> <TD><TEXTAREA NAME='newlist' ROWS='20' COLS='60' nowrap>";		

for ($L=0; $L< count ($mylist);$L++){
	$content.= "$mylist[$L]";

		<TR>	<TD>	<CENTER>	<P>
		<INPUT TYPE='button' VALUE='CANCEL' onClick='history.go(-1)'> Or <INPUT TYPE='submit' NAME='submit' VALUE='Update List'>
		</CENTER>	</TD>	</TR>	</TABLE></FORM>

else if ($submit == "Update List"){

$myfile = fopen ($cat_file,"w");
if  (!($myfile)){
print ("Error:\n");
print ("File '$myfile' could not be opened\n");

$newlist= ereg_replace( "\r\r", "\r", $newlist);

fputs($myfile, "$newlist");

fclose ($myfile);

$content.="<center><H3> <FONT FACE='Arial' COLOR='#999999'>The file <b>$list</b> has been updated</font></h3><br><br>
<P><A HREF='index.html'>Administration Entry</a> Or <A HREF='../index.html'>Notice Board</a></FONT></P></center>";

$t = new Template( $path);
                                  // create a template object named $t 

$t->set_file( "MyFileHandle", "$template");
                                  // set MyFileHandle = our template file 
$t->set_var(array( "TITLE" => $title,
					"FOOTER" => $bot,
				   "CONTENT" =>  $content));

                                  // set template variable 
$t->parse( "MyOutput", "MyFileHandle"); 
                                  // set template variable MyOutput = parsed file 
$t->p( "MyOutput");  // output the value of MyOutput (our parsed data) 


Return current item: noticeboard