Hello World,
i’m trying to do the steps of the code corner (day 2). I copied the syntax shown there and made some adjustments to my own needs.
So the code for my class.uiajaxchat.inc.php is now:
<?php
class uiajaxchat
{
var $public_functions = array(
‘ajaxchatinterface’ => True,
);
public function create_header ()
{
$GLOBALS['egw']->common->egw_header();
echo parse_navbar();
}
public function create_footer ()
{
$GLOBALS['egw']->common->egw_footer();
}
function ajaxinterface ()
{
$this->create_header();
if (trim($_POST['fname'].$_POST['sname'])!='')
{
//echo ''.$_SERVER['PHP_SELF'].'<br>';
echo "<br>Hello ".$_POST['fname']." ".$_POST['sname']."<br>";
echo "<form action='".$GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'AjaxChat.uiajaxchat.ajaxchatinterface','message'=>'YES'))."' method='post'>
<input type='submit' value=' Reload '>
</form>";
}
else
{
echo "Type a name to be greeted accordingly <br>";
echo "<form action='".$GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'AjaxChat.uiajaxchat.ajaxchatinterface','message'=>'NO'))."' 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>";
}
$this->create_footer();
}
}
When i try to run the script i allways get the error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /path_to_egw/AjaxChat/inc/class.uiajaxchat.inc.php on line 8
So the problem is with the “public function” declaration…
This error occured allready in the first steps of day two, so i just copy&paste this code and made my adjustments, hoping to get around them… but as you can see it didnt work.
I hope someone is able to help me. Thanks alot allready!
Greetings - Eric