0

I updated my app from cakephp 1.3 to 2.4 but I have a lot of errors and I don't know how to solve them... This error appeared after I made the database connection and correcting other errors. This is the screenshot that shows the errors: error after update This is the index.ctp part that it's causing error:

<?php 
    if($app_galleries)
    {
        $nr_gl = 0;
        foreach($app_galleries as $app_gallery)
        {
            $poza = AppController::getPrimaryPicture($app_gallery,'PictureToGallery','Gallery','picture_to_gallery_id','galleries');
            if($nr_gl%3==0)
            {
                echo '<div class="box_galleries">';
            }
?>
     <div class="box_gallery <?php echo ($nr_gl%3==2) ? 'noMarginRight' : '';?>">

I replaced $this->request->webroot with $this->webroot but still doesn't work...any ideas why? This is the view.php line 473 error:

if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
        $this->_currentType = self::TYPE_VIEW;
        $this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($viewFileName)));
        $this->Blocks->set('content', $this->_render($viewFileName));
        $this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($viewFileName)));
    }

This is the getPrimaryPicture function:

function getPrimaryPicture($var,$toImage,$image,$field,$path)
    {
        unset($poza);
        if(empty($var[$toImage]))
        {
            $poza = $this->webroot.'css/front/default_image.png';
        }
        else
        {
            foreach($var[$toImage] as $img)
            {
                if(isset($var[$image])){
                    if($var[$image][$field]==$img['id'])
                    {
                        $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$img['name'];
                    }
                }else{
                    if($var[$field]==$img['id'])
                    {
                        $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$img['name'];
                    }
                }
            }
            if(!isset($poza))
            {
                 $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$var[$toImage][0]['name'];
            }
        }
        return $poza;
    }
bicanul123
  • 427
  • 7
  • 21

0 Answers0