Top navigation not displaying when switching between languages

Permalink
I have the internationalization module installed along with the minified theme.

I have set up my languages (Spanish being default) and English my second language. All pages are mapped and I have been able to successfully create custom auto navs that appear successfully and switch successfully when using a "left Column" template.

I can not get the default top navigation to auto switch regardless of the template I use. What I mean by this is, Spanish navigation is displayed when on a Spanish page and English navigation displayed when on an English page.

The code below almost works and does display Spanish top nav when on Spanish pages. The problem is when I switch to English pages the top nav disappears completely. I am trying to get the english top nav to display when on english pages. (The side nav seems to be fine).

I am editing the header.php file using the following code (this is within my packages/minifiedtheme/themes/minifiedtheme/elements/header.php):

<?php 
   if(!$c->getAttribute('english_menus')) {
   $lh = Loader::helper('section', 'multilingual');
   $lang = $lh->getLanguage();
   $bt = BlockType::getByHandle('autonav');
   $bt->controller->displayPages = 'custom';
   if ($lang == "en"){
      $bt->controller->displayPagesCID = 166; //English section cID
   } else if ($lang == "es") {
      $bt->controller->displayPagesCID = 171; //Spanish section cID
   }
   $bt->controller->orderBy = 'display_asc';
   $bt->render('templates/minified');
}    
?>


Any help is much appreciated :)

I have attached an image file (gif) of some screen shots of my setup to help.

1 Attachment

 
TorstenKelsch replied on at Permalink Reply
TorstenKelsch
You could try using two if statements instead of if-else.

if ($lang == "en"){
    $bt->controller->displayPagesCID = 166; //English section cID
} 
if ($lang == "es") {
    $bt->controller->displayPagesCID = 171; //Spanish section cID
}