default userpic

Why doesn't this work?

Vote 0 Votes
  >





<a>"></a>

8 Replies

| Add a Reply
  • <!--<mt:SetVar name="thedate" value="nothing">
        <mt:Entries>
    
          <mt:If name="thedate" ne=<$mt:EntryDate format="%B %d, %Y"$>>
          <div id="date">        
          <$mt:EntryDate format="%B %d, %Y"$>
          </div>
          </mt:If>
    
        <h2><a href="<$mt:EntryLink$>"><$mt:EntryTitle$></h2></a>
        <mt:SetVarBlock name="thedate"><$mt:EntryDate format="%B %d, %Y"$></mt:SetVarBlock>
        </mt:Entries>
    -->
    
  • I can't post my code. WTF. How am I supposed to get help with my code if I can't post my code?

  • It's markdown and it's a little confusing! Click the link just above the reply box for a description, but the easiest way to make sure your code works is to insert 4 spaces before each line.

    Personally I'm not a fan of markdown either, but I think it's here to stay (at least until they get the RTE working in comments/new threads)

  • @Chinagreenelvis

    Not really sure what you're trying to do. Let me see if I can translate this:

    If variable called thedate is not the same as the Entry Date in Month Day, Year format, THEN: show the entry date in the Month Day, Year format.

    So you want to show only those entry dates that do not match your variable, thedate.

    You have defined the variable thedate to be the EntryDate itself, and then, with the if function, you want only those entries where their own entrydates are not their entrydates ... duh? Lost there. As far as I can tell, this is bound to give you a blank result, as there is no case where an entry's date doesn't match itself.

    Your setvarblock also needs to be at the top, not at the bottom.

    If you tried this:

      <mt:setvarblock name="thisdate"><MTDate format="%B %d, %Y"></mt:setvarblock>
      <mt:if name="thisdate" ne="<$mt:EntryDate format="%B %d, %Y"$>">
      <div id="date">        
      <$mt:EntryDate format="%B %d, %Y"$>
      </div>
      </mt:If>
    

    It should work. This way you will show only entries that are not made today. I presume you want something like that.

    Note, BTW, that your mt:if statement was incorrectly coded. There should be a double-quote (") between the last two > signs.

    Hope this helps. If it doesn't ... I tried ...

  • Actually, what I was trying to do was to display the date only if it was the first listed post in the span of a day. Like, if you make two posts in one day and you list only the titles of those posts, it doesn't post the date for each post, only one date per day. I figured out how to to it, but I'm still not sure how to post code here correctly...

    <mt:Entries>
    
    <mt:SetVarBlock name="currentdate"><$mt:EntryDate format="%B %d, %Y"$></mt:SetVarBlock>
    
      <mt:If name="currentdate" ne="$lastentrydate">
      <div id="date">        
      <$mt:EntryDate format="%B %d, %Y"$>
      </div>
      </mt:If>
    
    <h2><a href="<$mt:EntryLink$>"><$mt:EntryTitle$></a></h2>
    
    <mt:SetVarBlock name="lastentrydate"><$mt:EntryDate format="%B %d, %Y"$></mt:SetVarBlock>
    
    </mt:Entries>
    
  • Wow. That tag totally does exactly what I used crazy variable functions to achieve. Thanks!

Add a Reply

Forum Groups

151 405

Last Topic: MT Interface Missing by Sherri on Nov 10, 2008

36 144

Last Topic: Installation can't finish by Drazend on Nov 10, 2008

34 93

Last Topic: Creating your own Plug-in by jondauz on Nov 5, 2008

10 33

Last Topic: new licensing confusion by Neil Epstein on Aug 14, 2008

code.sixapart.com

62 226

Last Topic: Callback after blog publishing. by Tomato Interactive on Oct 27, 2008

34 98

Last Topic: Ajax Rating Plugin by kiran on Oct 17, 2008