Yii Counter Issue

Hi I’am trying to update visits of photo every time it views and here is my code

in contoller

public function actionView($id)


        $model = $this->loadModel($id);






when the url is

www.samplesite.com/arts/4 //4 is id of model

it works fine but whene i use model title in url it add +3 to visits instead of +1

www.samplesite.com/arts/4/life //life is art title

and my url manager is this

'urlFormat' => 'path',

            'showScriptName' => false,

            'caseSensitive' => false,


            'rules' => array(

                '~<ua:\w+>/<section:\w+>' => 'profile/name',

                '~<ua:\w+>' => 'profile/name',

                'site/page/<view:\w+>' => 'site/page',

                'arts/tag/<tag:.*?>' => 'arts/tag',

                'arts/<id:\d+>/*' => 'arts/view',

                '<controller:\w+>/<id:\d+>/<section:\w+>' => '<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>/<section:\w+>' => '<controller>/<action>',

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',


lol … can you post your updateCounters

Consider using a ready made extension for such as the one I’ve written, PcViewCounter.

updateCounters and saveCounters are bulidin methods in CActiveRecord.php

i found the reason!

it was a because of php version and i upgrade to 5.4 and the problem is solved! :lol: