Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Navigation main changes

Navigation main changes

Locked

Views: 3,318

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
17 Jun 2009, 1:47 PM
#1
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Navigation main changes

I have searched for a while and im trying to change the navigation main bar.

To use just images/buttons instead of the standard block its made with.

http://wallandmural-stencils.com/shop/

this site has it going across the top. that is what i would like to create for my navmain. Where/how do i create this part? :frusty:

17 Jun 2009, 8:05 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

well. the menu is produced with unordered list.

So, the styling is done in the <ul> and <li> tags.

One way of approaching it is to set a background image for the <li> tags in the list.

There are plenty of tutorial on the internet about how to create a navigation menu like this from an unordered list.

http://www.alistapart.com/articles/slidingdoors/
http://odyniec.net/articles/css-based-tabbed-menu/

These are actually for navigation tabs but the theory is the same. If you need more help just get in touch.

18 Jun 2009, 12:11 AM
#3
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

niccol:

well. the menu is produced with unordered list.

So, the styling is done in the <ul> and <li> tags.

One way of approaching it is to set a background image for the <li> tags in the list.

There are plenty of tutorial on the internet about how to create a navigation menu like this from an unordered list.

http://www.alistapart.com/articles/slidingdoors/
http://odyniec.net/articles/css-based-tabbed-menu/

These are actually for navigation tabs but the theory is the same. If you need more help just get in touch.

hmmm, well i tried for the better part of today to make it work from a few sites. But it looks like with the template im using that im going to have a bit of work to get it right. Oh well, guess I have to start somewhere right. Thanks for the help though.

18 Jun 2009, 8:08 AM
#4
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

OK. Well I have had a closer look.

The unordered list is completely broken.

    <ul>

    <li><a href="http://www.fusionspiritualemporium.com//">Home</a> :: 
    <a href="https://secure.hostmonster.com/~fusionsp//index.php?main_page=login&zenid=24d4453603aef1b1052519b8a3c0e4cf">Log In</a>
 :: 

<li><a href="http://www.fusionspiritualemporium.com//index.php?main_page=shopping_cart&zenid=24d4453603aef1b1052519b8a3c0e4cf">Shopping Cart</a></li>




<!--bof-header ezpage links-->

 ::   <a href="http://www.fusionspiritualemporium.com//index.php?main_page=privacy&zenid=24d4453603aef1b1052519b8a3c0e4cf">Privacy Notice</a>
<!--eof-header ezpage links-->
</li>
</ul>

A whole load of closing </li> tags are missing. Without a proper structure to the list the display is just not going to play the game. Each list element needs to be enclosed in a pair of <li></li> tags to get the styling to work correctly.

So, to start you need to sort out this unordered list. SOme of the problems may be the template, others may be your own editing. Let's go back to a clean slate.

Find the file: tpl_header.php (templates/yourtemplate/common/)

Find the code section where the div #navMain is built.

In the default file this looks like:

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>
</ul>
</div>
<div id="navMainSearch"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
<br class="clearBoth" />
</div>
<!--eof-navigation display-->

You can find the pairs of <li></li> tags quite clearly. If your version of the file doesn't look like this then we have found an area of 'interest'. I would replace the section in your file with the code above.

If you want to add extra items to the menu this is fine. You just need to make sure that they are part of the unordered list.

So, it might look like:

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>
<li>NEW ITEM HERE</li>
</ul>
</div>
<div id="navMainSearch"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>



<br class="clearBoth" />
</div>
<!--eof-navigation display-->

That will mean that the list is built in a well formed way and then the styling has a bit of chance of working.

The styling you have in the stylesheet doesn't look too far of the mark. Once you have sorted out the list we will be able to see the effect of the styling clearly and tweak it to get that perfect effect.

Let me know how you get on. I am in meetings for the next few hours but after that am at my desk and will help all I can. It looks like you've worked out how to get image backgrounds into the sideboxes and this is just as simple as that so we should have no problem!

Nik

18 Jun 2009, 8:10 AM
#5
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

Oh, and it might be helpful to have a unaltered, default version of tpl_header.php handy so you can compare the code.

Attached is one :smile:

25 Jun 2009, 3:35 PM
#6
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

niccol:

Oh, and it might be helpful to have a unaltered, default version of tpl_header.php handy so you can compare the code.

Attached is one :smile:

thank you very much for all of your help. I have been pretty busy lately and havent had a chance to attempt any of the changes but im sure this will make a big difference.

When i first started using this template I noticed a lot of issues. So, it has been a work in progress to fix everything.

So, when I actually can get a chance to work on it I will let you know how it comes out.

Thanks again.

1 Jul 2009, 6:25 PM
#7
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

ok i think i fixed all the list issues. Upon looking thru it all, it didnt really look broken. It was just not in a good layout.

The unordered list wasnt a separate deal for every item like it should be.

it opened it at the beginning and closed the whole thing at the end. one great big UL?? but i changed and separated it all out. Maybe you could look at it again and tell me if i got it right this time?

If so, i found a few places that may work for my nav bar.

thanks again,

chris

1 Jul 2009, 8:40 PM
#8
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

Well, it is a lot better than it was. :smile:

The privacy notice is still not contained in <li> tags and I am not sure about the nbsp outside <li> tags.

If you can post your tpl_header.php file I'll have a look at it. Something is a bit odd at the moment.

2 Jul 2009, 3:08 AM
#9
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

ok here is the tpl_header file. I have added some extra things that i found to make the header. i have also changed the css file to work with it. it added the images, but it is still not right.

    

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">

 <ul>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><span></span><?php echo  HEADER_TITLE_CATALOG; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><span></span><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><span></span><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><span></span><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>

<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><span></span><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
        <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><span></span><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>




<!--bof-header ezpage links-->
<li><a <?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<?php echo '';
      require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?>
<?php } ?><span></span></li></a>
<!--eof-header ezpage links-->
</ul>


<!--eof-navigation display-->
</div></div>
 
<!--eof-header logo and navigation display-->
2 Jul 2009, 8:36 AM
#10
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

OK well you're getting there.

You need to change the tpl_header file slightly.

<!--bof-header ezpage links-->
<li><a <?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<?php echo '';
      require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?>
<?php } ?><span></span></li></a>
<!--eof-header ezpage links--> 

This is a bit messed up. On the page it produces:

<!--bof-header ezpage links-->
<li><a   <a href="http://www.fusionspiritualemporium.com//index.php?main_page=privacy&zenid=cd049bfce0c41ee44547aa93f78ceca6">Privacy Notice</a>
<span></span></li></a>
<!--eof-header ezpage links-->

The <li> tags and <a> tags are not inside one another so it is incorrect. As it happen you have an extra set of <a> tags anyway which is what is producing the extra 'button' on the screen. The php require produces the entire link including the <a> tags. So change the tpl file to:

<!--bof-header ezpage links-->
<li><?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<?php echo '';
      require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?>
<?php } ?><span></span></li>
<!--eof-header ezpage links--> 

That should see you straight for the time being. I would get rid of the separators as they only confuse the issue now. This is done from the admin section.

This will work fine as long as you only have that one EZ page. If you add more then all of the easy pages will be enclosed in one set of <li> tags.
Personally, I think it might be better to link directly to the Privacy Notice rather than use the php require for EZpages. It would make the code easier to follow and would not break with more additions.

6 Jul 2009, 9:44 PM
#11
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

I think its finally straightened out. Now for the buttons. I have searched all over for tutorials on the sliding door buttons. I really think my main issue is from the template I started with. There is soo much useless code I have been removing since I started my site.

Here is my current css file that i have for the buttons.

/* SilverFish Customizations */
body {margin: 0; font-family: verdana, arial, helvetica, sans-serif; font-size: 62.5%; color: #000000; margin: 0px 0px 50px 0px; color: #333; background-color: #ffffff;}
body#popupShippingEstimator, body#popupImage, body#infoShoppingCart, body#popupCVVHelp {background:none;}

#mainWrapper {background-color: #ffffff; text-align: left; width: 100%; vertical-align: top; border: none ; margin: 0px;}
table { font-size: 100% }

#navFusionWrapper {background-color: #ffffff; margin: 0; padding: 0; width: 100% }

/*
header
*/


#navMainWrapper {width: 100%; background-color: #ffffff; margin: 0; padding: 0;}

#navMain {
text-align: center;
list-style: none;
margin: 0px; 
width: 100%; 
color: #ffffff; 
background-color: #000030; 
font-size: 93%;}

#navMain ul { 
margin: 2px 0; 
width: 100%;
padding: 5px; 
list-style: none;
 text-align: center;
 line-height: 3.5em; 
 text-align: center;

 }

#navMain ul li {
display: inline;
font-size: 13px; 
font-weight: bold; 
text-transform: uppercase; 
color: #ffffff; 
text-align: center;

 }
#navMain ul li a  {
text-align: center;
text-decoration: none; 
padding: 4px 15px 0 0; 
margin: 0; 
margin-right: 8px;
color: #ffffff; 

}

#navMain ul li a span {
text-align: center;
padding-right: 15px;
display: inline;
margin-top: -4px;
height: 24px;
}

#navMain ul li a {
color: #ffffff;
background: url(../images/button_normal_header.gif) no-repeat top right;
}

#navMain ul li a:hover {
color: #ffffff;
background: url(../images/button_over_header.gif) no-repeat top left;
}
6 Jul 2009, 9:53 PM
#12
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

hey, well done! It's a list.

Remind me what you actually want it to look like. :smile:

6 Aug 2009, 2:59 PM
#13
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

niccol:

hey, well done! It's a list.

Remind me what you actually want it to look like. :smile:

Hey sorry but I had changed shifts at my job and for a while I was working nights. But Im back now.

I just want there to be buttons across the top. Now, it displays a partial button that I set up using a sliding door style. I can see it switch back and forth like its trying to do it right, but i just cant get it right. If possible, I would like even a gel button?
But its only part of the button. It doesnt look like the button i actually created??
Im so frustrated, Im debating finding a new template that already has buttons across the top and starting over. :frusty:

6 Aug 2009, 8:28 PM
#14
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

The problem that you are having is that when you define the <li>s as inline you cannot control their size, or the size of anything inside them. To control their size they need to be blocks rather than inline. But if they are blocks then they align vertically.

This is the problem right?

One fix is to define the <li> tags as inline-block. Huh? Inline-block is a type of display that has some of the characteristics of each type of display.

There are other options. A good display of some of the less used display settings and their problems with browser support is shown at http://www.brunildo.org/test/shrink-to-fit.html.

Inline-block works on the majority of browsers with a few hacks. But you'll need to test on as many as you can.

Try getting rid of what you have and trying this as a start. As soon as you can define the size of the <a> tags then the sliding door / sprite approach will work fine.

#navMain ul { 
display:block;
margin: 2px 0; 
list-style: none;
 text-align: center;
 line-height: 3.5em; 
 }

#navMain ul li {
position:relative;
display: inline-block;
width:160px;
font-size: 13px; 
font-weight: bold; 
text-transform: uppercase; 
color: #ffffff; 
border:1px red solid;
zoom:1;
*display: inline;
 }

#navMain ul li a  {
display:block;
width:100%;
height:100%;
text-align: center;
text-decoration: none; 
color: #ffffff; 
}

Your going to find some problems with browsers but all the hacks for the various browsers are out there. eg http://flipc.blogspot.com/2009/02/damn-ie7-and-inline-block.html Basically with ie you need to trigger hasLayout. Desribing that is a bit beyond this post!

Another way of approaching the whole problem is to use a float:left to make all the <li>s to align horizontally. This works really well but the problem that you have is trying to get the block of <li>s to align in the center of the page. It tend to do this but then very few of my pages are symmetrical anyway.

9 Aug 2009, 2:38 PM
#15
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

hmm, wierd? Ok I changed the code to what you wrote and now the buttons I made partially show up at the bottom of the text. But the lines still have this wierd border around them that I am not sure where it came from.

I can see it switching to the highlighted button too. But why is my button hid below the text?

14 Aug 2009, 4:34 PM
#16
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

Hi,

Sorry for the delay I have been away and actually still am not back on my machine.

Can you attach the background image that you are using to your next post please? Thanks!

16 Aug 2009, 1:06 AM
#17
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

niccol:

Hi,

Sorry for the delay I have been away and actually still am not back on my machine.

Can you attach the background image that you are using to your next post please? Thanks!

are you talking about my avatar?

Anyways, I believe i have finally achieved some version of what i was looking for. Now i need to work on the actual button image.

Thanks by the way for all your efforts. One last question, I am having issues with the last button on the ezpage section. Here is what the code looks like. I cant seem to place the <span> in the right place??

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">

 <ul>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo  '<span>' . HEADER_TITLE_CATALOG . '</span>'; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo '<span>' . HEADER_TITLE_LOGOFF . '</span>'; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo '<span>' . HEADER_TITLE_MY_ACCOUNT . '</span>'; ?></a></li>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo '<span>' . HEADER_TITLE_LOGIN . '</span>'; ?></a></li>
<?php } } ?>

<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo '<span>' . HEADER_TITLE_CART_CONTENTS . '</span>'; ?></a></li>
<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
        <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo '<span>' . HEADER_TITLE_CHECKOUT . '</span>'; ?></a></li>
<?php }?>




<!--bof-header ezpage links-->
<li><?php if  (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) {  ?>
<?php echo '' ;
      require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php');  ?>
<?php }   ?></li>
<!--eof-header ezpage links-->
</ul>


<!--eof-navigation display-->
</div></div>
16 Aug 2009, 4:37 PM
#18
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Navigation main changes

No I was asking to see the image that you were using as the background for the buttons as I suspected that the image itself was part of your problem.

To put a span in the same place as the other links you are going to have to edit:

tpl_ezpages_bar_header.php

Which is called in the line:

require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php');  ?> 
17 Aug 2009, 2:45 PM
#19
fusionsp avatar

fusionsp

Zen Follower

Join Date:
Jun 2008
Posts:
204
Plugin Contributions:
0

Re: Navigation main changes

wow finally...thanks for all your help. its not exactly what I wanted, but at least now I can make the images look better.