Skip to content

Instantly share code, notes, and snippets.

@markpasc
Created August 12, 2008 17:22
Show Gist options
  • Save markpasc/5094 to your computer and use it in GitHub Desktop.
Save markpasc/5094 to your computer and use it in GitHub Desktop.
<mt:Order>
<mt:Entries lastn="10">
<mt:OrderItem>
<mt:SetVarBlock name="order_by"><mt:EntryDate utc="1" format="%Y%m%d%H%M%S"></mt:SetVarBlock>
<mt:Include module="Entry">
<mt:SetVarBlock name="last_entry_yday"><mt:EntryDate format="%j"></mt:SetVarBlock>
<mt:SetVarBlock name="last_entry_year"><mt:EntryDate format="%Y"></mt:SetVarBlock>
</mt:OrderItem>
</mt:Entries>
<mt:SetVarBlock name="current_yday"><mt:Date format="%j"></mt:SetVarBlock>
<mt:If name="current_yday" lt="last_entry_yday">
<!-- Account for dates crossing the year boundary -->
<mt:SetVarBlock name="last_entry_last_day_of_year"><mt:Var name="last_entry_year">1231000000</mt:SetVarBlock>
<mt:SetVarBlock name="last_entry_days_in_year"><mt:Date name="%j" ts="$last_entry_last_day_of_year"></mt:SetVarBlock>
<mt:SetVar name="current_yday" op="add" value="$last_entry_days_in_year">
</mt:If>
<!-- Calculate how many days ago the last entry was -->
<mt:SetVarBlock name="days_of_entries"><mt:Var name="current_yday"></mt:SetVarBlock>
<mt:SetVar name="days_of_entries" op="sub" value="$last_entry_yday">
<mt:ActionStreams days="$days_of_entries">
<mt:OrderItem>
<mt:SetVarBlock name="order_by"><mt:StreamActionDate utc="1" format="%Y%m%d%H%M%S"></mt:SetVarBlock>
<mt:Include module="Action">
</mt:OrderItem>
</mt:ActionStreams>
</mt:Order>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment