0

I get this error.. Parse error:syntax error, unexpected T_PUBLIC in C:\filename here on line 573

On this line...

<i>public function findMaterialPostedThisMonth(){ </i>

The code...

public function findMaterialPostedThisMonth(){  
                    if (!empty($_GET['time'])) {
                            $month = date('n', $_GET['time']);
                            $year = date('Y', $_GET['time']);
                            if (!empty($_GET['pnc']) && $_GET['pnc'] == 'n') $month++;
                            if (!empty($_GET['pnc']) && $_GET['pnc'] == 'p') $month--;
                    } 
                    else {
                            $month = date('n');
                            $year = date('Y');
                    }

                    return $this->findAll(array(
                            'condition'=>'create_time > :time1 AND create_time < :time2
                                            AND t.status='.self::STATUS_PUBLISHED,
                            'params'=>array(':time1' => date("Y-m-d", mktime(0,0,0,$month,1,$year)),
                                            ':time2' => date("Y-m-d", mktime(0,0,0,$month+1,1,$year)),
                                    ),
                            'order'=>'t.create_time DESC',
                    ));
            }
OlegB
  • 71
  • 6
  • your not in a class, simply remove the word 'public' –  Nov 09 '15 at 21:53
  • I want to add a calendar of materials to the site is built on Yii Framework, and used in this manual [link](http://loco.ru/materials/139-yii-calendar-materialov) – OlegB Nov 09 '15 at 22:00
  • you would not get that error unless your function was outside of a class. so perhaps you put it in the wrong place –  Nov 09 '15 at 22:02

1 Answers1

0

Get rid of public unless the function is being declared inside a class.

wogsland
  • 9,106
  • 19
  • 57
  • 93