user-pic

Sidebar widget/template module identifying category incorrectly

Vote 0 Votes

Hi,

I'm assigning a different header graphic for a recent comments widget depending on the page's category (label). When I'm on the category index of Share, the widget displays a comment from the Share category correctly, but the header is coming up with the graphic for a Learn category. The header is called up using a body_id variable that also shows up in the page's body tag where it's correct. To see what was going on, I put in an mt:CategoryLabel tag and lo and behold, the widget thinks it's in the Learn category, not Share! Yet when I put the mt:CategoryLabel tag in the main Sidebar template, it comes up with Share. I had this problem with another of my widgets as well. Any idea what's going on? I think I've seen this happen before.

The widget code for your reference:

<mt:Comments lastn="1" include_blogs="1" sort_order="descend">

<div class="yousaid-module">
<h3><mt:If name="body_id" eq="learn"><img src="<$mt:BlogURL$>images/assets/headers/you-learned.gif" alt="You learned..." /><mt:ElseIf name="body_id" eq="share"><img src="<$mt:BlogURL$>images/assets/headers/you-shared.gif" alt="You shared..." /><mt:ElseIf name="share_templ" eq="Share"><img src="<$mt:BlogURL$>images/assets/headers/you-shared.gif" alt="You shared..." /><mt:ElseIf name="body_id" eq="do"><img src="<$mt:BlogURL$>images/assets/headers/you-did.gif" alt="You did..." /><mt:Else><img src="<$mt:BlogURL$>images/assets/headers/you-said.gif" alt="You said..." /></mt:If></h3>

<div id="yousaid-module-inner">
"<$mt:CommentBody words="15"$>..." &#8212; <$mt:CommentAuthor$> <br /><div id="yousaid-meta">On <a href="<$mt:CommentLink$>"><mt:CommentEntry><$mt:EntryTitle$></mt:CommentEntry> &raquo;</i></a></div>

</div>
</div>

</mt:Comments>

Thanks!

Erika

Reported on Movable Type 4.3

2 Replies

| Add a Reply
  • Where are you getting body_id from? Why not just do

    <mt:If tag="CategoryLabel" eq="Share">
    <mt:ElseIf tag="CategoryLabel" eq="Learn">
    </mt:If>

  • body_id was one of my own variables. I couldn't do categorylabel because the content is tagged with a sub-category of share of which there are 8.

    Our structure has changed so I'm not concerned about this issue anymore! Thanks, Mike.

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

694 2908

Last Topic: Blogspot to Movable Type by sdude on Feb 8, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 565

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012