From ac03c24d01a463658f1b9fdc8b77c14f1ea75d2e Mon Sep 17 00:00:00 2001 From: leithoff Date: Tue, 26 Jul 2016 13:36:36 +0200 Subject: [PATCH] Updated CodeCorner3 (markdown) --- CodeCorner3.md | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/CodeCorner3.md b/CodeCorner3.md index 98bb7a9..142caeb 100644 --- a/CodeCorner3.md +++ b/CodeCorner3.md @@ -327,31 +327,37 @@ This function is added to the class.test_ui.inc.php file.
 
-function index($content=null)
-{
-    $debug=false;
-    if (is_array($content)){
-        $debug=true;
-        // after submit
-        $content['message']=print_r($content,true);
-        $content['datetime']=time();
-        $content['who']=$content['name'];
-        $content['name']='';
-        $content['ergebnis']=$content['wert1']*$content['wert2'];
-    } else {
-        // first call
-        /*
-        $content=array(
-            'who'=>', please type a name ...',
-        );
-        */
-    }
-    $tpl=new etemplate('test.index');
-    $tpl->set_cell_attribute('debuginfos','disabled',!$debug); 
-    $tpl->exec('test.test_ui.index',$content);
-    // the debug info will be displayed at the very end of the page
-    //_debug_array($content);
-}
+	function index($content=null)
+	{
+		$debug=false;
+		if (is_array($content)){
+		    $debug=true;
+		    // after submit
+			if ($content['submit'])
+			{
+				$content['message']=print_r($content,true)."\n".'to continue please type a name ...';
+				$content['datetime']=time();
+				$content['test_firstname']='';
+				$content['test_name']='';
+			} elseif ($content['new'])
+			{
+				$content['message']='cleared form !'."\n".'to continue please type a name ...';
+				$content['datetime']=time();
+				$content['test_firstname']='';
+				$content['test_name']='';
+			}
+		} else {
+		    // first call
+		    $content=array(
+		        'message'=>'... please type a name ...',
+		    );
+		}
+		$tpl=new etemplate('test.index');
+		$tpl->set_cell_attribute('debuginfos','disabled',!$debug); 
+		$tpl->exec('test.test_ui.index',$content);
+		// the debug info will be displayed at the very end of the page
+		//_debug_array($content);
+	}
 

  @@ -377,7 +383,7 @@ var $public_functions = array(
Step 10
-
You have to add a constructor to your test_ui class:
+
You should add a constructor to your test_ui class: