Re: Parse error inside my component....plz HELP
You're missing the closing brace of `ServiceCompositionEngineComponent.` Add another "}" after closing `getRespType`. hth grigri On Nov 20, 11:36 am, paulos nikolo wrote: > Line 18 is abstract class ResponseParser{ > My PHP Version checked ans it is 5.2.6Really weird! > > 2009/11/20 AD7six > > > > > On 20 nov, 11:14, Paulos23 wrote: > > > Morning Guys, > > > I have built a Component for my needs and i get an error> > > > Parse error: syntax error, unexpected T_CLASS, expecting T_VARIABLE in > > > C:\Program Files\xampp\htdocs\voyage~voyage-source\app\controllers > > > \components\service_composition_engine.php on line 18 > > > Try reading line 18 - and check what version of php you're using. > > > -- > > > You received this message because you are subscribed to the Google Groups > > "CakePHP" group. > > To post to this group, send email to cake-...@googlegroups.com. > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com > > . > > For more options, visit this group at > >http://groups.google.com/group/cake-php?hl=. > > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cake-php?hl=.
Re: Parse error inside my component....plz HELP
Line 18 is abstract class ResponseParser{ My PHP Version checked ans it is 5.2.6Really weird! 2009/11/20 AD7six > > > On 20 nov, 11:14, Paulos23 wrote: > > Morning Guys, > > I have built a Component for my needs and i get an error> > > Parse error: syntax error, unexpected T_CLASS, expecting T_VARIABLE in > > C:\Program Files\xampp\htdocs\voyage~voyage-source\app\controllers > > \components\service_composition_engine.php on line 18 > > Try reading line 18 - and check what version of php you're using. > > -- > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-...@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/cake-php?hl=. > > > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cake-php?hl=.
Re: Parse error inside my component....plz HELP
On 20 nov, 11:14, Paulos23 wrote: > Morning Guys, > I have built a Component for my needs and i get an error> > Parse error: syntax error, unexpected T_CLASS, expecting T_VARIABLE in > C:\Program Files\xampp\htdocs\voyage~voyage-source\app\controllers > \components\service_composition_engine.php on line 18 Try reading line 18 - and check what version of php you're using. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cake-php?hl=.
Parse error inside my component....plz HELP
Morning Guys, I have built a Component for my needs and i get an error> Parse error: syntax error, unexpected T_CLASS, expecting T_VARIABLE in C:\Program Files\xampp\htdocs\voyage~voyage-source\app\controllers \components\service_composition_engine.php on line 18 I can't figure out what cause this problem.Maybe it's a bug?If any1 can help me i ' d appreciated so much! Here is my component's code: controller =& $controller; } function getRespType($responseType,$text,$model,$mappings = array(), $limit){ if ($responseType == 'XML'){ $obj=new XmlParser; $obj->modelParse($text,$model,$mappings = array(),$limit); } else if($responseType == 'JSON'){ $obj=new JsonParser; $obj->modelParse($text,$model,$mappings = array(),$limit); } } abstract class ResponseParser{ abstract public function modelParse($text,$model,$mappings = array(), $limit) { } } //Using X-Path to implement XML parsing class XmlParser extends ResponseParser { var modelFields = array(array()); public function modelParse($text,$model,$mappings = array(),$limit){ $xml = new SimpleXMLElement($text); switch($model){ case($model == "Location"): $modelField[0][0] = $xml->xpath(''.$mappings[0].''); //Saves total results if (empty($modelField[0][0])){ //Checks if total results field is empty break; } else{ for ($j = 1; $j <= $limit; $j += 1) { // Loop to access all children for ($i = 0; $i <= sizeof($mappings); $i += 1) {// Loop to map each child $test = $mappings[$i+1]; $mapper = $xml->xpath(''.$test.''); if (!empty($mapper)){ $modelField[$j][$i] = $mapper; }else { $modelField[$j][$i] = 'not_available'; } } } return($modelField); } break; default: for ($i = 0; $i < sizeof($mappings); $i += 1) { $test = $xml->xpath(''.$mappings[$i].''); if (!empty($test)){ $modelField[0][$i] = $test; }else { $modelField[0][$i] = 'not_available'; } } return($modelField); break; } } } //Using J-Path to implement JSON parsing class JsonParser extends ResponseParser{ var modelFields = array(array()); public function modelParse($text,$model,$mappings = array(),$limit){ $parser = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $o = $parser->decode($text); switch($model){ case($model == "Location"): $modelField[0][0] = jsonPath($o, "$.'.$mappings[0].'"); if (empty($modelField[0][0])){ break; } else{ for ($j = 1; $j <= $limit; $j += 1) {// Loop to access all children for ($i = 0; $i <= sizeof($mappings); $i += 1) { $test = $mappings[$i+1]; $mapper = jsonPath($o, "$.'.$test.'"); if (!empty($mapper)){ $modelField[$j][$i] = $mapper; }else { $modelField[$j][$i] = 'not_available'; } } } return($modelField); } break; default: for ($i = 0; $i < sizeof($mappings); $i += 1) { $test = jsonPath($o, "$.'.$mappings[$i].'"); if (!empty($test)){ $modelField[0][$i] = $test; }else { $modelField[0][$i] = 'not_available'; } }