Jump to content

ZEND: Strict Standards, Creating default object from empty value?


Recommended Posts

Hi everyone im am currently getting the following error

 

Strict Standards: Creating default object from empty value in /Users/name/Sites/websiteX/application/controllers/ArtistsController.php on line 40

 

my layout is like this

 

-views/

        /scripts

                    /artists

                              /index.phtml

                    /index

                            /index.phtml

 

In the IndexController I have used the same code in the ArtistsController.  The path index/index works perfectly but the artists/index throws the error code.

 

Here is the Controller

 

<?php

/**
* Description of ArtistsController
*
* @author 
*/
class ArtistsController extends Zend_Controller_Action {

   /**
    * accessing our session variable
    * @var Zend_Session_Namespace
    */
   protected $session;

   public function preDispatch()
   {
       $this->session = new Zend_Session_Namespace('Default');



   }

   public function loadModel($class, $module = null)
    {
        $modelDir = $this->getFrontController()->getModuleDirectory($module)
                       . DIRECTORY_SEPARATOR . 'models';
        Zend_Loader::loadClass($class, $modelDir);

        // if we got here - then file is included
        return $class;
    }



   public function init()
   {
        	$uri = $this->_request->getPathInfo();
	$activeNav = $this->view->navigation()->findByUri($uri);
	$activeNav->active = true;
	$activeNav->setClass("active");
      
   }

  public function indexAction()
   {


   }

 

It says line 40 is here

 

   public function init()
   {
        	$uri = $this->_request->getPathInfo();
	$activeNav = $this->view->navigation()->findByUri($uri);
	$activeNav->active = true;
	$activeNav->setClass("active");
      
   }

 

Which calls the navigation.xml file.  It works in the IndexController but not the ArtistsController?

 

Can anybody explain what im doing wrong?  many thanks!  :shy:

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.