Topic: Function update for 0.5

Hey all, I have been trying to update this function to 0.5 and i must be missing something:

function graffitipost($aFormValues) 
{ 
    $graffiti = $aFormValues['graffititext']; 
    $email = $aFormValues['email']; 
    $name = $aFormValues['name']; 
    $message = $aFormValues['hiddenmessage']; 

$_POST['graffiti'] = $graffiti;
$_POST['email'] = $email;
$_POST['name'] = $name;
$_POST['message'] = $message;
    
    ob_start();
        include('engine.php');
    ob_end_clean();
    
    $file= "posts.php"; 
    ob_start();
    include($file);
    $contents = ob_get_clean();
    
    $objResponse = new xajaxResponse();
    xajax->assign('graffiti', 'innerHTML', $contents);
    return $objResponse;
     
}

Any ideas?

Re: Function update for 0.5

$objResponse->assign('graffiti', 'innerHTML', $contents);

Re: Function update for 0.5

I am still getting :

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/graffiti/public_html/index.php on line 37

<?php 
require("scripts/xajax/xajax_core/xajax.inc.php"); 

$xajax = new xajax();
$xajax->registerFunction("graffitipost");

function graffitipost($aFormValues) 
{ 
    $graffiti = $aFormValues['graffititext']; 
    $email = $aFormValues['email']; 
    $name = $aFormValues['name']; 
    $message = $aFormValues['hiddenmessage']; 

$_POST['graffiti'] = $graffiti;
$_POST['email'] = $email;
$_POST['name'] = $name;
$_POST['message'] = $message;
    
    ob_start();
        include('engine.php');
    ob_end_clean();
    
    $file= "posts.php"; 
    ob_start();
    include($file);
    $contents = ob_get_clean();
    
    $objResponse = new xajaxResponse();
    $objResponse->assign('graffiti', 'innerHTML', $contents);
    return $objResponse;
     
}

//$xajax->debugOn();
//$xajax->statusmessagesOn(); 

xajax->processRequest();

line37 is xajax->processRequest();

Re: Function update for 0.5

$xajax = your object

$xajax->processRequest();

Re: Function update for 0.5

ok, I think i got that figured out, but now I am getting:

Parse error: syntax error, unexpected $end in /home/graffiti/public_html/index.php on line 85

85 is also the last line... I am at a loss here..

Here is the full source for the page:

http://graffiti.udderweb.com/source.php?file=index.php

6 (edited by cAHVA 2007-01-02 9:19:03 AM)

Re: Function update for 0.5

You havent closed your function. You had that earlier but its missing now in your sourcecode.

    return $objResponse;
     
}

Re: Function update for 0.5

I have it on line 30?

Am I missing it somewhere else?

28.     $objResponse = new xajaxResponse();
29.     $objResponse->assign('graffiti', 'innerHTML', $contents);
30.     return $objResponse;

Re: Function update for 0.5

Looks to me like line 31 should be }...

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Function update for 0.5

first you dont need to call it twice. To keep things simple and like an example on the site i created a common php file.

require_once("./xajax/xajax_core/xajax.inc.php");
$xajax = new xajax('optional uri');

//$xajax->setFlag('debug',true);

$xajax->registerFunction('function','optional file location');
$xajax->processRequest();

then in my main script

require_once('./xajax.common.php');

function something()
{
$objResponse = new xajaxResponse();

$objResponse->Script($someScript);
$objResponse->Assign('assignsomething','innerHTML',$content);
return $objResponse;

}

hope that helps a bit.

10 (edited by nicorar 2013-01-04 7:12:44 AM)

Re: Function update for 0.5

I actually enjoyed reading through this posting.Many thanks.