I just showed only the things i thought were important, My apologies, the
full code of the BaseEndController init method was posted in the previous
email.

On Sun, Mar 15, 2009 at 2:45 PM, Matthew Weier O'Phinney
<[email protected]>wrote:

> -- vadim gavrilov <[email protected]> wrote
> (on Sunday, 15 March 2009, 02:21 PM +0200):
> > Yes i do, this is the full init function of the BaseEndController
> >
> >     public function init()
> >     {
> >         # Must be called
> >         parent::init();
>
> The original you pasted did not -- this is the verbatim init() method
> from BaseEndController per your original post:
>
>    public function init()
>    {
>        # Set Up view properties
>        $this->view->breadcrumbs = array();
>
>        # Create the base breadcrumb
>        $this->view->breadcrumbs[] = $this->BB( $this->lang->_('GL1'),
> array('index', 'index', 'admin'));
>    }
>
> So, either you've changed things since then, or you pasted the wrong
> thing originally.
>
>
> >         # Define public url
> >         $this->view->public_url = Zend_Registry::get('config')->general->
> > webhost . $this->getRequest()->getBaseUrl() . '/' . $this->this_module .
> '/';
> >
> >         # Add CSS & Js files required
> >         $this->view->headLink()->appendStylesheet(
> $this->view->public_url .
> > 'css/all.css')->appendStylesheet( $this->view->public_url . 'css/ie.css',
> 'text
> > /css', 'lt IE 7');
> >         $this->view->headScript()->appendFile( $this->view->public_url .
> 'js/
> > tabs.js', 'text/javascript')->appendFile( $this->view->public_url . 'js/
> > navigation.js', 'text/javascript')->appendFile( $this->view->public_url .
> 'js/
> > pngfix.js', 'text/javascript', array('conditional' => 'IE 6', 'defer' =>
> > null));
> >
> >         # Clear old sessions
> >         $this->ClearOldSessions();
> >
> >          # Did we change the language?
> >         $cookie_language = $this->GetCookie('end_language');
> >         if( $cookie_language )
> >         {
> >             $this->default_language = $cookie_language;
> >         }
> >
> >         # Over ride using manual language switch
> >         if( $this->_getParam('setlang') ) # Do we change it now?
> >         {
> >             if(array_key_exists($this->_getParam('setlang'), $this->
> > _supported_languages)) # Language is available?
> >             {
> >                 $this->default_language = $this->_getParam('setlang');
> >                 $this->SetCookie('end_language',
> $this->default_language); #
> > Save cookie
> >             }
> >         }
> >
> >         # Do we need to add the rtl css file?
> >         if( $this->default_language == 'he' )
> >         {
> >             $this->view->headLink()->appendStylesheet(
> $this->view->public_url
> > . 'css/rtl.css');
> >         }
> >
> >         # Load Language & Cache It
> >         $this->LoadLanguage();
> >
> >         # Set Title
> >         $this->view->headTitle( $this->lang->_('GL0') );
> >
> >         # Check auth
> >         if(!$this->CheckLoggedInUser() && $this->_request->controller !=
> > 'login')
> >         {
> >             $this->Boink('login/index');
> >         }
> >
> >         # Load Member information
> >         $this->LoadMemberInfo();
> >
> >         # Create the base breadcrumb
> >         $this->BB( $this->lang->_('GL1'), array('index', 'index',
> 'admin'));
> >     }
> >
> > On Sun, Mar 15, 2009 at 2:17 PM, Matthew Weier O'Phinney <
> [email protected]>
> > wrote:
> >
> >     -- vadim gavrilov <[email protected]> wrote
> >     (on Sunday, 15 March 2009, 12:07 PM +0200):
> >     > I have the following structure:
> >
> >     <cut-n-paste>
> >
> >     > but for some reason the $this->breadcrumbs array has only one
> element
> >     which was
> >     > added in the BaseEndController class. the element that was added in
> the
> >     > indexcontroller class was not actually added to the array and is
> not
> >     shown when
> >     > it prints it.
> >     >
> >     > Any idea why, Or how to solve it? any other approach for something
> >     similar?
> >
> >     In your BaseEndController class' init() method, you're not calling
> >     parent::init().
> >
> >     > class BaseMasterController extends Zend_Controller_Action
> >     > {
> >     >     public $view;
> >     >     public $breadcrumbs = array();
> >     >
> >     >     public function init()
> >     >     {
> >     >         # Define module path
> >     >         defined('MODULE_PATH')
> >     >         or define('MODULE_PATH',
> Zend_Controller_Front::getInstance()->
> >     > getModuleDirectory() . '/');
> >     >
> >     >         # Define controller path
> >     >         defined('CON_PATH')
> >     >         or define('CON_PATH',
> Zend_Controller_Front::getInstance()->
> >     > getModuleDirectory() . '/');
> >     >
> >     >         # Set layout and views directories
> >     >         Zend_Layout::startMvc( MODULE_PATH .'/layouts/scripts' );
> >     >
> >     >         # Init views object
> >     >         $this->view = Zend_Layout::getMvcInstance()->getView();
> >     >         $this->view->doctype(
> Zend_Registry::get('config')->layout->
> >     doctype );
> >     >         $this->view->setScriptPath( MODULE_PATH . 'views/scripts/'
> );
> >     >         $this->viewRenderer =
> $this->_helper->getHelper('viewRenderer');
> >     >
> $this->viewRenderer->setView($this->view)->setViewBasePathSpec(
> >     > MODULE_PATH . 'views/scripts/'
> )->setViewScriptPathSpec(':controller
> >     > /:action.phtml');
> >     >
> >     >         # Build Helpers
> >     >         $this->view->addHelperPath( MODULE_PATH . 'views/helpers/',
> >     'Helper');
> >     >
> >     >         # setting content type and character set
> >     >
> $this->view->headMeta()->appendHttpEquiv('X-UA-Compatible','IE=
> >     > EmulateIE7')->appendHttpEquiv('Content-Type','text/html;
> charset=UTF-8')
> >     ->
> >     > appendHttpEquiv('Content-Language', 'en-US');
> >     >
> >     >         # setting a separator string for segments:
> >     >         $this->view->headTitle()->setSeparator(' :: ');
> >     >
> >     >         # Load the DB Adapter
> >     >         $this->db = Zend_Db::factory(Zend_Registry::get('config')->
> >     production->
> >     > database);
> >     >
> >     >         # Clean Globals
> >     >         $this->input = new Input;
> >     >      }
> >     > }
> >     >
> >     > class BaseEndController extends BaseMasterController
> >     > {
> >     >     public function init()
> >     >     {
> >     >         # Set Up view properties
> >     >                 $this->view->breadcrumbs = array();
> >     >
> >     >               # Create the base breadcrumb
> >     >                 $this->view->breadcrumbs[] = $this->BB(
> $this->lang->_
> >     ('GL1'),
> >     > array('index', 'index', 'admin'));
> >     >     }
> >     > }
> >     >
> >     > class Admin_IndexController extends BaseEndController
> >     > {
> >     >
> >     >     public function indexAction()
> >     >     {
> >     >         $this->view->breadcrumbs[] = "123";
> >     >         $this->viewRenderer->render('index');
> >     >     }
> >     > }
> >     >
> >     > then in the layout i am doing:
> >     >
> >     > <?php if( $this->breadcrumbs ): ?>
> >     >             <ul class="breadcrumbs">
> >     >                 <?php foreach($this->breadcrumbs as $crumb): ?>
> >     >                 <li><?php echo $crumb; ?></li>
> >     >                 <?php endforeach; ?>
> >     >             </ul>
> >     >         <?php endif; ?>
> >     >
> >     > but for some reason the $this->breadcrumbs array has only one
> element
> >     which was
> >     > added in the BaseEndController class. the element that was added in
> the
> >     > indexcontroller class was not actually added to the array and is
> not
> >     shown when
> >     > it prints it.
> >     >
> >     > Any idea why, Or how to solve it? any other approach for something
> >     similar?
> >     >
> >     > Thanks.
> >     >
> >     >
> >     > --
> >     > Vincent Gabriel.
> >     > Lead Developer, Senior Support.
> >     > Zend Certified Engineer.
> >     >
> >     >
> >     >
> >     >
> >
> >     --
> >     Matthew Weier O'Phinney
> >     Software Architect       | [email protected]
> >     Zend Framework           | http://framework.zend.com/
> >
> >
> >
> >
> > --
> > Vincent Gabriel.
> > Lead Developer, Senior Support.
> > Zend Certified Engineer.
> >
> >
> >
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect       | [email protected]
> Zend Framework           | http://framework.zend.com/
>



-- 
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.

Reply via email to