I am trying to tweak my navigation so that some of the Primary Links are offset.

For instance it is like this now:

Example Link
Example Link
Example Link
Knives
Pistols
Rifles
Bows
Ammunition
Equip & Acc
Example Link
Guns
Hunting
Safety
Example Link
Example Link
Example Link

And this is what I want to have:

Example Link
Example Link
Example Link
     Knives
     Pistols
     Rifles
     Bows
     Ammunition
     Equip & Acc
Example Link
     Guns
     Hunting
     Safety
Example Link
Example Link
Example Link

I have messed around with it as much as possible and can not figure out for the life of me how to get multiple spaces in front of those certain Primary Links. I did mess around with adding the following code to my template.php file and I can manipulate it and put certain characters (a, b, c, 3, &, #) in front of them with one space, but not multiple spaces.

function guns_menu_links($links) {
  if (!count($links)) {
    return '';
  }
  $level_tmp = explode('-', key($links));
  $level = $level_tmp[0];
  $output = "<ul class=\"links-$level navButts\">\n";
  foreach ($links as $index => $link) {
    $output .= '<li';
    if (stristr($index, 'active')) {
      $output .= ' class="active"';
    }
	$output .= '>';
	if ($link['title'] == 'Knives' | $link['title'] == 'Pistols' | $link['title'] == 'Rifles' | $link['title'] == 'Bows' | $link['title'] == 'Ammunition' | $link['title'] == 'Equip & Acc' | $link['title'] == 'Guns' | $link['title'] == 'Hunting' | $link['title'] == 'Safety') {
		$thisTitle = "     ".$link['title'];
		$output .= l($thisTitle, $link['href'], $link['attributes'], $link['query'], $link['fragment'])."</li>\n";
		continue;
	}
    $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'])."</li>\n";
  }
 
  $output .= "</ul>";

  return $output;
}

Anyone have any ideas?

Thanks...

Comments

peacho’s picture

I'm not sure if you could implement it based on the code you have (you seem to have much better PHP knowledge than me), but usually to do something like that, it's pretty useful to use nested lists, i.e.:

<ul>
  <li>Item 1</li>
  <ul>
    <li>Subitem 1</li>
    <li>Subitem 2</li>
  </ul>
</ul>

Like I said, I'm not 100% sure on that, but it may be worth a try.

Retnuh’s picture

This is true. I want to stay with all of them being in the same list though. This way I do not have to go re-tweak my CSS or make any other changes.
I would prefer to find a way to just add a few spaces (non breaking spaces HTML code doesn't work) so that I can keep as much of the code that I have now complete.

Anyone else have any ideas?

So some how I need multiple spaces inside my PHP code and I am lost.

Thanks...

Retnuh’s picture

Anyone else have any ideas?

Retnuh’s picture

You can see what I am trying to do by this:

Current website: http://www.gunsacrossamerica.com/dev

Image mock up of how website is to look: http://www.gunsacrossamerica.com/test

Granted the website looks different in several ways, but you can see how I am looking to move some of the navigation links over to the right a few spaces.

Thanks in advance for the help...

Retnuh’s picture

I am still looking for help on this...

Anyone?

dotpex’s picture

http://www.gunsacrossamerica.com/dev/admin/build/menu-customize/primary-...
You need to create sub-links in primary menu and check Expanded on root item, and menu will print:

<ul>
  <li>Item 1</li>
  <ul>
    <li>Subitem 1</li>
    <li>Subitem 2</li>
  </ul>
</ul>
Retnuh’s picture

I was going to mess with it that way but I would have to go back and screw with my css to make that work. My current CSS is dealing with one ul not two.

If there is no other way in the PHP code to do it, I guess this will be my only option.

Thanks Dotpex...

Retnuh’s picture

I just made the change for Knives and Pistols. I made them a sub of Reviews and checked the Expanded next to Reviews. Now they are missing.
http://www.gunsacrossamerica.com/dev/

Do you know what might be wrong?
I used Firebug to inspect it and I can not see where they are printed out.

dotpex’s picture

Retnuh’s picture

I did what you said with the sub menu and they are not showing up. Do you have any idea?
I do not think I should have to add a module to show these links, they should be shown by doing what you had mentioned.