Help - Search - Members - Calendar
Full Version: How to use SSI with the search template?
Movable Type Community Forum > Additional Resources > Tips and Tricks
jbassford
Okay, here's my problem.

I've designed my site so that the Movable Type output is in a frame on the right-hand side of the page. So far, I've done this by editing the templates (that I've configured to be named *.shtml) to do this sort of thing:

CODE
<div class="left">Non-MT content</div>
<div class="right">MT content</div>

I add the non-MT content through the use of server side includes that point to a text file containing the code I want - that way I only need to modify a single file and the whole site is updated.

This all works just fine - except for the search template because it's called from the mt-search.cgi script (which uses default.tmpl), rather than a *.shtml file.

When I put something like:

<!--#include virtual="file.txt" -->

into the appropriate location in default.tmpl, mt-search.cgi doesn't parse it but, rather, simply outputs it as is. This does me no good at all. (I believe it's a limitation of Apache, and most other Web servers, at present.)

I've tried thinking of various alternatives here but don't know enough about either Apache or MT to get this to work out properly. As far as I can tell I need one of two things to happen:

1. Apache to parse the SSI directive that's being returned to the CGI script prior to sending the data to the client.

2. MT to use default.tmpl to write out a *.shtml file which would then be pointed to as the target for the browser to load. (Rather than just the CGI output.)

Until I can resolve this, I have everything formatted just as I want, except that the only content that's produced is that from MT's search - while the frame at the left of the page (which should show the content of the "file.txt" file) remains blank...

You can see this problem "live" if you go to my personal page and try to do a search of my entries (try using "blog" as the search term).
girlie
What about <MTInclude file="file.txt">?

QUOTE
You can also use the <MTInclude> tag in your search templates to include template modules or external files. You can even use tags like this, which require a weblog to be in context (because template modules are stored on a per-weblog basis), outside of the <MTSearchResults> container. However, there are caveats with this method, and you should be careful with using this if you have multiple weblogs. For example, if you use

<$MTInclude module="Header"$>

in a template, the system needs to know which weblog to look in for the module named Header. If there are search results found, the system will look in the weblog that is earliest alphabetically; if there are no search results, Movable Type will simply try to load a weblog from your database (the determination of the weblog that is chosen is undefined).
jbassford
> What about <MTInclude file="file.txt">?

Well, don't I feel like an idiot. <grin> Talk about a classic example of searching for something in all of the wrong places when it was right in front of me all along.

Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.