Page 1 of 1

Module Generator Problem

Posted: Sun Nov 03, 2013 7:07 am
by OmarDoleymi
Hi I am using Module Generator to create a module, lets name it "Carousel", when I tried to access the Carousel in the Content tab

it gave me the following error:
Parse error: syntax error, unexpected T_FUNCTION in /home/content/80/9944080/html/modules/CGExtensions/lib/class.cge_array.php on line 171

This is the code that i extracted from the file above

and the problem according to the parse error is in the line:

$func = function($a,$b) use ($key,$is_string,$casecompare)

I can't seem to figure what's wrong

Code: Select all

 /**
   * Sort array of hashes by key
   **/
  static public function hashsort(&$input,$key,$is_string = false,$casecompare = false)
  {
    $func = function($a,$b) use ($key,$is_string,$casecompare) {
      if( $is_string ) {
	if( $casecompare ) {
	  return strcasecmp($a[$key],$b[$key]);
	}
	else {
	  return strcmp($a[$key],$b[$key]);
	}
      }
      if( $a[$key] == $b[$key] ) return 0;
      if( $a[$key] < $b[$key] ) return -1;
      return 1;
    };
can someone advice me on that matter please?

Re: Module Generator Problem

Posted: Sun Nov 03, 2013 12:44 pm
by Rolf
Do you have PHP 5.3+ at your webserver?

Re: Module Generator Problem

Posted: Sun Nov 03, 2013 12:46 pm
by OmarDoleymi
Nope It appears that I have 5.2.17 according to CMSMS - System Info

Re: Module Generator Problem

Posted: Sun Nov 03, 2013 1:54 pm
by Rolf
Cmsms works on 5.2.4+, but the modules from Calguy1000 require PHP 5.3+

Re: Module Generator Problem

Posted: Sun Nov 03, 2013 1:56 pm
by OmarDoleymi
cool thanks for the help ... I went on and updated to php5.3 when you asked me that question :D

Problem Solved :D

thanks buddy I owe you one :)