CodeIgniter Forums
Help with template header - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: Help with template header (/thread-64994.html)

Help with template header - samdrp - 04-18-2016

New to code igniter and would appreciate any advice.

I am trying to make the link in my header go to the pub_category_name instead of a list of the stores in the category.

Each category will only have one store/location to go to which is assigned in admin. So there will never be a need to display more than one for each category.

Here is the code from the header

              <li class="gnb"><a class="mn-stores" href="stores">Publications</a>
                  <div class="menu-contain-gift">
                          foreach ($mainPublications->result() as $row){
                              if ($row->pub_name != ''){
                                  <li><a href="stores/?pubid=<?php echo $row->id; ?>"><?php echo $row->pub_name;?></a>
                                  <?php if (in_array($row->id, $pub_root_id_arr)){?>
                                      <div class="submenu-contain">
                                              foreach ($all_publication->result() as $row1){
                                                  if ($row1->pub_name != '' && $row->id==$row1->rootID){ ?>
                                              <li style="position: relative;"><a href="stores/?pubid=<?php echo $row1->id; ?>"><?php echo $row1->pub_name;?></a>
                                                  <?php }
                                              } ?>
                                  <?php } ?>
                              <?php }
                          } ?>

RE: Help with template header - Wouter60 - 04-19-2016

Please explain what's going wrong with your current code.
And what do you mean by "header"? A menu at the top of your website?

RE: Help with template header - samdrp - 04-21-2016

Thanks for the reply

The code is not necessarily wrong but we just want to skip the page where it show the listing of store in the category.
It is set up so that each category is assigned only one store (it will never be more than one) and the same for sub category. Currently when you click on category or sub category it show the page where it lists the store in the category then you have to click on the store to view. This all works but we want to bypass the list page and make it so when you click on the category it goes directly to the store assigned that category.

Here is the link. Click on publication in top menu of the site. you will see 2 categories and sub categories

RE: Help with template header - samdrp - 04-21-2016