user-pic

CSS styling for each date in Multiblog

Vote 0 Votes

I have a blog whose main index is entries from two blogs included through Multiblog. I have the posts from each blog grouped by date using the following code:

<mt:MultiBlog>
	<mt:Entries lastn="20" include_blogs="x,y" sort_order="descend">
	<MTDateHeader>  <h2><$mt:EntryDate format="%A, %d %B %Y at %I:%M %p"$></h2></MTDateHeader>
				<mt:SetVarBlock name="BlogID"><mt:BlogID></mt:SetVarBlock>
					<mt:If name="BlogID" eq="x"><div class="x">ENTRY CONTENT</div></mt:if>
					<mt:If name="BlogID" eq="y"><div class="y">ENTRY CONTENT</div></mt:if>
	</mt:Entries>
</mt:MultiBlog>

I'd like to wrap each group of entries for blog "y" that occur on the same date within a div, sort of like how <MTDateHeader> will print once only for each block of dates. I would use MTDateHeader but that omits subsequent entries on the same date.

Basically, I'm trying to get final code that schematically looks like this

Some Date
	<div class="x">
		blog x entry 3
		blog x entry 2
		blog x entry 1
	</div>

Another Date, not necessarily different
<div class="y">
blog y entry 3
blog y entry 2
blog y entry 1
</div>

The important part is that I wrap all the blog entries in the appropriate div class structure.

Thank you, in advance, for any pointers you can provide.

Unfortunately, MTDateHeader will not span the

Reported on Movable Type 4.3

2 Replies

| Add a Reply
  • I suspected that MTDateHeader would help me get this to work and, after much scrutiny, I conjured a solution which was MTDateFooter. The following code does pretty much what I want.

    <mt:MultiBlog>
    	<mt:Entries lastn="20" include_blogs="5,15" sort_order="descend">
    	<mt:SetVarBlock name="BlogID"><mt:BlogID></mt:SetVarBlock>
    	<MTDateHeader>
    		<mt:If name="BlogID" eq="x"><div class="x"></mt:If>
    		<mt:If name="BlogID" eq="y"><div class="y"></mt:If>
    		<h2><$mt:EntryDate$></h2>
    	</MTDateHeader>
    		<$mt:Include module="Entry Body"$>
    	<MTDateFooter>
    		</div>
    	</MTDateFooter>
    	</mt:Entries>
    </mt:MultiBlog>
    
    

  • You're doing a little too much in a couple spots. Your code should work fine, but this'll make things a little simpler and easier to maintain, as you won't have to create yet another If should another blog get added:

        <$mt:BlogID setvar="BlogID"$>
        <MTDateHeader>
            <div class="<$mt:Var name="BlogID"$>">
    

    (This is only the changed bits, obviously.)

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

1428 5076

Last Topic: Stupid Question? How to make a static homepage by Jeremy on Feb 3, 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