Ken Edwards

Search Results By Blog

Vote 0 Votes

I have a MT search field that uses IncludeBlogs 1,2,3. On the results template I would like to separate the results out so that each blog, 1,2,3, uses a different summaries so they all look different, and they have a heading of what the blog actually is.

I have seen this on templates before, but heck if I can find the code for it. Any help out there?

Reported on Movable Type 4.3

10 Replies

| Add a Reply
  • Hi Ken,

    To differentiate the results you could use:
    <mt:If tag="BlogID" eq="1">

    Kind Regards,
    Mihai Bocsaru

    ----------------------------------
    Daily Movable Type Consultant

    Web Development
    Movable Type Consulting
    Six Apart Partner

    http://www.pro-it-service.com/
    ----------------------------------

    Movable Type Demo
    http://www.movabletypedemo.org/
    ----------------------------------

    Open Melody Demo
    http://www.openmelodydemo.org/

  • ...
    				<div class="search-results-container autopagerize_page_element">
    					</mt:SearchResultsHeader>
    						<mt:If tag="BlogID" eq="16">
    						<$mt:Include module="Entry Summary Writer"$>
    						<mt:Else tag="BlogID" eq="5">
    						<$mt:Include module="Entry Summary Gallery"$>
    						<mt:Else>
    						<$mt:Include module="Entry Summary"$>
    						</mt:If>
    					<mt:SearchResultsFooter>
    				</div>
    ...
    

    Not working.

  • It works for me, but I am not using mt:Else.

    Just a few mt:If loops, one for each blog id.

  • I just tried that, and nada.

    Maybe I am not making myself clear. I am displaying the results from all 3 blogs, 1, 5, 16 in this case, in the search results template in BlogID 1. I am not trying to make a universal results template I can use on any of the blogs.

    Yes, I just swapped the BlogID around to test it, and sure enough it did what I expected it to do, it is only displaying the single BlogID on the template, because that *is* the BlogID of the template.

  • The logic that I've mentioned to you should be implemented on the universal results template.

    You won't be able to display results from other blogs, if you keep a specific blog context.

  • There is no universal Search Results template in a stock MT 4.37 install. And I have seen this code before. The template is displaying content from 3 blogs, so there has to be a way to format that content based on template logic.

  • There is one, and it is inside this file:
    /search_templates/default.tmpl

    I am using an exact copy of the template on that source code file, as well as inside any of the blogs that are referenced on the IncludeBlogs variable.

  • I did it. I made an alt template. Then it worked. Ha, then I read your reply ;)

    I am not using IncludeBlogs as a hidden field because I have a Config Directive set.

    Thanks for pointing me in the right direction.

  • You're very welcome Ken!

    Kind Regards,
    Mihai Bocsaru

    ----------------------------------
    Daily Movable Type Consultant

    Web Development
    Movable Type Consulting
    Six Apart Partner

    http://www.pro-it-service.com/
    ----------------------------------

    Movable Type Demo
    http://www.movabletypedemo.org/
    ----------------------------------

    Open Melody Demo
    http://www.openmelodydemo.org/

Add a Reply

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

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

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

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

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

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

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