Alternate is not being used

Topics: Troubleshooting, Writing themes
Aug 31, 2012 at 12:06 AM

I've created an alternate "MenuItemLink-main-menu.cshtml" using the ShapeTracer; and using ShapeTracer - if I remove the file; it tells me the default is being used; and if I use the alternate - it says that the Alternate is being used; and when I click "View Template" - I see my code; but when I click view HTML or View Source - the default html is being rendered and not mine.

To be 100% sure; here is my code within the alternate:

<a href="@Model.Href"><h1>@Model.Text</h1><div class="menu-main-menu-child-bg"></div></a

>

The actual output is just the <a> tag with url and text; but no <h1> and no <div>:

<a href="#">text</a>

Any ideas? Alternates are being used; all my others are working.

thanks!

Aug 31, 2012 at 4:50 PM
Edited Aug 31, 2012 at 4:56 PM

It should be noted; that I have two navigations one in the header zone and one in the navigation zone; if I use the catch-all MenuItemLink.cshtml (catch all) - the first menu items in the header use this alternate; but the second menu still somehow ignores it and uses something else. What's a good trouble-shooting tool to verify which cshtml is actually being used (since shape must be making an assumption).

(changing the order doesn't affect anything)

thanks - bill

 

Aug 31, 2012 at 6:22 PM
Edited Aug 31, 2012 at 6:54 PM

OK - just further testing revealed that Content Menu Item is not using the alternate; but Custom Links in the menu are using the MenuItemLink.cshtml.  What would be the correct alternate to use in order for my Content Menu Items?  Shape Tracer is not giving me the right name.

NOTE: When I use "MenuItemLink-ContentMenuItem.cshtml" - it does use that alternate; but now I need it to be specific to only that menu - the name of that menu is "main-menu". What would that alternate name be? (MenuItemLink-main-menu.cshml doesn't work)

thanks

Developer
Sep 1, 2012 at 11:28 AM

I don't know if such an alternate exists, but perhaps you could generate one by implementing a shape table provider?

Dec 4, 2012 at 9:33 AM
Edited Dec 4, 2012 at 9:35 AM

Hi,

Having exact same problem.  ( Orchard 1.6 )

The "Menu-main-menu.cshtml" and the "MenuItem-main-menu.cshtml"  are used correctly. Actually I have also "Menu-footer-menu.cshtml" and the "MenuItem-footer-menu.cshtml" for a different menu in the footer. Also working correctly.

MenuItemLink-footer-menu.cshtml and MenuItemLink-main-menu.cshtml are not being used. ( Shape Tracing says it IS being used but is isn't; same as Fruber says in his post)

MenuItemLink-ContentMenuItem.cshtml IS being used when I add this file to my theme. But since I have 2 different menu's with different styling this is not working for me. ( as MenuItemLink-main-menu-ContentMenuItem.cshtml and MenuItemLink-footer-menu-ContentMenuItem.cshtml aren't working... )

MenuItemLink-footer-menu.cshtml looks like: 

<a href="...">text</a>

 

MenuItemLink-main-menu.cshtml looks like:

 

<a class="btn" href="...">text</a>

 

I don't know what Skywalker is suggesting with: "but perhaps you could generate one by implementing a shape table provider?" How do I do that? Or did Fruber found an alternative way?

Tnx!

Coordinator
Dec 5, 2012 at 7:17 AM

http://weblogs.asp.net/bleroy/archive/2011/01/10/orchard-shapeshifting.aspx

Dec 5, 2012 at 3:53 PM

So the problem is that there isn't an alternate provided for the MenuItemLink-shape by Orchard out-of-the-box. (And there is for Menu and MenuItem)

You're link demo's how to create such an alternate myself, right? 

Why is it then that the shape tracer suggests that there IS an alternate? It even shows the correct template but it doesn't use it. Do you know what I mean, or should I make a screenshot? To me it look like a bug now. 

Coordinator
Dec 5, 2012 at 6:57 PM

If it's a bug, please file it in the issue tracker.

Jan 17, 2013 at 4:34 PM

Has anyone raised tis as a bug yet as I have the same issue?

Coordinator
Jan 17, 2013 at 5:08 PM

Search the issue tracker and find out ;)

Feb 22, 2013 at 12:45 PM
Is this bug not filed yet in the issue tracker?
Jul 22, 2013 at 6:52 PM
Edited Jul 22, 2013 at 7:24 PM
Has this bug been filed yet? I can't seem to find it in the list of issues, but I'm running into the same problem.

For MenuItemLink:

Image

Image
Coordinator
Jul 22, 2013 at 8:13 PM
Then please file it.
Jul 22, 2013 at 8:23 PM
Edited Jul 22, 2013 at 8:23 PM
I didn't want to make a duplicate if it was already filed and I just missed it in my search. Anyway, I went ahead and filed it.

Here it is.

If anyone else runs into this issue and stumbles upon this post, please upvote the issue.
Oct 1, 2013 at 1:02 AM
Hey guys, take a look at the module discussed here, it might help you out:

https://orchard.codeplex.com/discussions/450043#editor
Oct 1, 2013 at 2:20 AM
@fcu423, thanks for the link!
Oct 2, 2013 at 5:19 PM
ihake wrote:
@fcu423, thanks for the link!
I'm really glad it helped!