Primary & Secondary links don't work


Author Message
ChrisA

Posted: 3/24/2010
Quote message 

Hi,

I have been trying to get the Primary/Secondary links to work with no sucess and I'm really getting fed up of this software, initially I thought it would save time but the amount of code bloat and extra bugs it introduces I'd rather have my money back and do it by hand the normal way.

Anyway here's what we're trying to do:

I have the primary links set up with children used as secondary links. I had to display the primary links in a block rather than enabling them through the theme in the normal way as Artisteer doesn't support what is a Drupal fundemental feature.

I've come to the sections of the site where we need the secondary menus to display and of course they don't appear. The secondary links are in the sidebar and not under the primary links which are at the top.

I've spent a lot of time side stepping the Artisteer limitations on this site and so would rather get this bit fixed rather than having to start all over again. Also I can't now alter anything usuing Artisteer as it would over write all the modifications I've made.

Anyone any ideas?

Thanks
Chris
 
Phil

Posted: 3/24/2010
Quote message 

Are you enabling the menus in the Admin>blocks section?
 
sbotts

Posted: 3/25/2010
Quote message 

ChrisA, if you're trying to display primary and 2ndary links as drop-down menus in the menu block:

1. Click "Administer"
2. Click "Site Building"
3. Click "Blocks"

A new page opens showing all available blocks. The "Disabled" blocks are at the bottom.

4. Scroll down to the disabled blocks
5. Locate "Primary links"

To the right of "Primary Links," there's a drop-down menu "<none>"

6. Click on the drop-down arrow next to "<none>"
7. Select "Menu" from the drop-down menu

The "Primary Links" option has disappeared, because it has moved up to the menu block section, so scroll up and confirm that it's where it ought to be.

8. Scroll all the way to the bottom of the page and click "Save blocks."

Do the same thing for your secondary links menu.

Once you have both Primary and Secondary links in the menu section, you can rearrange them by dragging and dropping them into the order you prefer, but remember to click "save" when you're done.
from the list of assigned and unassigned blocks, locate "primary links" and "secondary links," (unassigned);
select to display them in the "menu" block (at right);
rearrange their order, if needed;
click "save" blocks.
 
sbotts

Posted: 3/25/2010
Quote message 

Oops, I mean: primary and secondary links are items that you are adding to block sections.
 
me, yet again

Posted: 3/25/2010
Quote message 

And ignore everything after "...when you're done."

I must be really tired!
 
ChrisA

Posted: 3/25/2010
Quote message 

Hi all,

Thanks for your replies. I don't think I've done a good job of explaining the problem.

I can get the primary links displays via a block but I don't want to use that method for displaying the links. I want to be able to enable it via the theme as is normally standard in a Drupal setup. ie. Admin->Theme->Global Config-> Primary & Secondary Links (checkboxes).

I'm trying to use the primary links with children as the second nav and use so use the Primary links for the source of the secondary links as well via the Admin->Site Build->Menus->Settings.

I want the secondary links not displayed in a drop down but as an inline menu on the left whereas the primary links are at the top of the page. Miles away from each other in terms of a web page. The reason I do it this way is that the active links all tie up nicely. If I create a separate menu for the secondary links then the active links don't work properly.

This works fine in previous sites I've done modifying theme like Garland or Barlow. As I would move the line:

<?php if (count($secondary_links)){ ?>
<?php print theme('links', $secondary_links, array('class' => 'links secondary_menu')) ?>
<?php } ?>

To where the secondary links should be. In artisteer not only do you not have this line but when moving their $navigation line around it doesn't display the secondary links.

Also Artisteer seems to somehow disable the theme_menu_tree() function as I tried to display the links manually and couldn't get it to work whereas it works fine in Barlow. I even created a separate menu and could only display that via inserting it in a block as theme_menu_tree() didn't work with a normal drupal menu in Artisteer either.




 
Will J

Posted: 4/10/2010
Quote message 

Hello Chris, Have made any progress with this issue? I am having the same exact issue, and I can't seem to find a work around for it. I too would think the developers would support a basic drupal feature such as secondary links.
 
lostchord

Posted: 4/12/2010
Quote message 

This seems to be a step in the right direction... replace the contents of block-navigation.tpl.php with something like this:


<?php $primary = menu_primary_links(); ?>
<?php print theme('links', $primary, array('class' => 'links primary_menu')) ?>
<?php $secondary = menu_secondary_links(); ?>
<?php print theme('links', $secondary, array('class' => 'links secondary_menu')) ?>


Still need to sort out the theme aspects but I think it's a start.

cheers

Once more into the validation....
 
lostchord

Posted: 4/13/2010
Quote message 

This goes a bit further than the previous posts I made.

(1) block-navigation.tpl.php is replaced by:

<code>
<?php $primary = menu_primary_links(); ?>
<?php $content = theme('links', $primary, array('class' => 'art-menu'))?>
<?php echo art_menu_fixer($content, false, 'art-menu'); ?>
<?php $secondary = menu_secondary_links(); ?>
<?php $content = theme('links', $secondary, array('class' => 'art-menu'))?>
<?php echo art_menu_fixer($content, false, 'art-menu'); ?>
</code>

(2) Add the following slightly edited version of art_menu_worker to common_methods.php:

<code>
function art_menu_fixer($content = NULL, $show_sub_menus, $menu_class) {
if (!$content) {
return '';
}

$output = $content;
// used to support Menutrails module
$output = str_replace("active-trail", "active-trail active", $output);

$menu_str = ' class="menu"';
if(strpos($output, $menu_str) !== FALSE) {
$empty_str = '';
$pattern = '/class="menu"/i';
$replacement = 'class="'. $menu_class .'"';
$output = preg_replace($pattern, $replacement, $output, 1);
$output = str_replace($menu_str, $empty_str, $output);
}

$output = preg_replace('~(<a [^>]*>)([^<]*)(</a>)~', '$1<span class="l"></span><span class="r"></span><span class="t">$2</span>$3', $output);

return $output;
}
</code>

At this point it's down to tweaking the css and maybe adding a bit extra to cater for the secondary links in terms of styling (which would need to be reflected in the block-navigation change).

Hope this helps.

cheers
 
ChrisA

Posted: 4/19/2010
Quote message 

@Will J

Yeah I have got it to work in the end, though not as elegantly as lostchord's solution. Which I will have a go at implementing.

In the end I created separate menu's for the various section and displayed them via node-SECTIONORCONTENTTYPE.tpl.php using a line like this:

<div id="submenu">
<?php print theme('links', menu_navigation_links('menu-YOURMENU'), array('class' => 'submenu-links')); ?>
</div>

Then in combination with the Menutrails module I tie them up via css. Trouble is I'm having problems with MenuTrails as it doesn't seem to work that well with an Artisteer theme for some reason. By that I mean it doesn't highlight the primary links properly for a given content type but if I use the Barlow theme it works properly. This happens whether the section has a submenu or not so it's not anything to do with that.

@lostchord - Thanks for that I'll give it go. It might fix my menutrails issues with Artisteer.

Cheers
 
jprivett

Posted: 7/10/2010
Quote message 

:-/

So I am having the same issues. Using the following code
<?php echo theme('links', $primary_links, array('class' => 'art-menu')); ?>
i can get the links to show up the menu separator shows, but the other styles go out the window regarding the buttons.

Any ideas?

lostchord, what does your page.tpl.php code look like referencing your solution?
I have tried this without using the admin > block > primary links setting but I still get code no joy.

Thanks in advance,

-James
 
Dave

Posted: 5/7/2011
Quote message 

Hi, same problem here...
Sorry for posting it again (http://www.artisteer.com/Default.aspx?post_id=104583&p=forum_post&topicsPage=16&forum_id=18) but I'm quite dissapointed that such basic drupal functionality is not integrated in Artisteer. I googled hours and hours for a solution (I thought it was my fault).

Is this issue fixed in Artisteer 3? Is there a quick fix (I'm not sure if I understood the last postings)?

thanks & regards
Dave