Thanks John.

I used debug() and I was receiving the values I expected. I realized
that $this->params wasn't holding anything on the two problem cases,
so I added an additional if wrapping the first 3 checks:

if (isset($this->params['pass']['0'])) {

        if ($this->params['pass']['0'] == 'home') {$pageNum = 1;}
        elseif ($this->params['pass']['0'] == 'about') {$pageNum = 4;}
        elseif ($this->params['pass']['0'] == 'contact') {$pageNum = 5;}

}

Goes off without a hitch now :)

On Oct 20, 2:10 pm, John Andersen <[email protected]> wrote:
> Try to put a debug($this->params) before you use it, so you can
> confirm that there are the values and indexes that you expect!
> Enjoy,
>    John
>
> On Oct 20, 8:18 pm, StkMtd <[email protected]> wrote:
>
> > Cake Version:
> > 1.2.5
>
> > Environment:
> > Apache and MySQL on localhost
>
> > Summary:
> > I'm creating a nav element to simplify the code on my main layout.
>
> > Details:
> > The nav element first checks which controller is active, or which page
> > in the pages controller. It then assigns an integer value to the
> > variable $pageNum, based on which of the 5 pages is currently being
> > viewed. From here it spits out a <ul> with the menu item that is
> > currently active styled with a unique CSS style.
>
> > See the code for nav.ctp here:http://bin.cakephp.org/saved/51689
>
> > Errors Received:
> > Notice (8): Undefined index: 0 [APP\views\elements\nav.ctp, line 5]
> > Notice (8): Undefined index: 0 [APP\views\elements\nav.ctp, line 6]
> > Notice (8): Undefined index: 0 [APP\views\elements\nav.ctp, line 7]
>
> > Lines 2-7 (or view @CakeBin above):
> > 2. // determine the page being viewed
> > 3. // 1 = home, 2 = work, 3 = blog, 4 = about, 5 = contact
> > 4. $pageNum = 0;
> > 5. if ($this->params['pass']['0'] == 'home') {$pageNum = 1;}
> > 6. elseif ($this->params['pass']['0'] == 'about') {$pageNum = 4;}
> > 7. elseif ($this->params['pass']['0'] == 'contact') {$pageNum = 5;}
>
> > Full Error Dump (key lines are highlighted in 
> > yellow):http://pastebay.com/62559
>
> > Conclusions:
> > I believe that this error has something to do with $pageNum being set
> > to 0 (as per the error message). The strange thing about this error is
> > that it only appears when I'm viewing the main layout through the work
> > (works) and blog (posts) controllers. The home, about, and contact
> > pages do not yield this error.
>
> > I've tried my damndest to hack this thing out on my own, but I've
> > posted as much information as I could gather in hopes that someone can
> > give me a hand in figuring out what is wrong, and potentially how I
> > could fix it. Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to