Updated CodeCorner2 (markdown)

leithoff 2016-07-05 15:24:22 +02:00
parent 459672c75c
commit 08a7d11c7b

@ -94,4 +94,60 @@ The $_GET['menuaction'] parameter is taken into account, split and evaluated in
By now there is no such class in the file nor the required function or the stuff we did not know about at this time.
So we created a class.
We created the required function testinterface.
We added the functionality.
We added the functionality.
```php
<?php
class test_ui
{
public function testinterface ()
{
if (trim($_POST['fname'].$_POST['sname'])!='')
{
echo "<br>Hello ".$_POST['fname']." ".$_POST['sname']."<br>";
echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>
<input type='submit' value=' Reload '>
</form>";
}
else
{
echo "Type a name to be greeted accordingly <br>";
echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>
<p>first name:<br><input name='fname' type='text' size='30' maxlength='30'></p>
<p>name:<br><input name='sname' type='text' size='30' maxlength='40'></p>
<input type='submit' value=' Submit '>
<input type='reset' value=' Cancel'>
</form>";
}
}
}
```
And we were badly disappointed, since we were thrown to some strange error on the screen instead of our application.
You must tell your class which function is to be called via a direct call from the outside.
This is done with an array public_functions where the public accessible functions are stored with the functionname as array-key and a boolean as value.
So we added ...
```php
var $public_functions = array(
'testinterface' => True,
);
```
... to our code.
Much better, but some nagging error in the upper left corner of the frame where our app appears: ```An error occurred``` ... we added
```php
public function create_header ()
{
common::egw_header();
echo parse_navbar();
}
public function create_footer ()
{
common::egw_footer();
}
```
so we recieve our inital page o.k.