Help - Search - Members - Calendar
Full Version: Displaying category posts on a non-MT home page
Movable Type Community Forum > Additional Resources > Tips and Tricks
craftyhilary
Hi,

I have a personal blog where I post on a variety of topics. I have category archiving enabled. I'm also redesigning a web site I created for my knitting circle. Since one of my most active categories in my blog is about crafts, I'd like to find a way to display the most recent posts in this category on the knitting circle web page. However, I don't want to make that site a blog, or run it via MT.

In the support forum, I found posts that discussed how to do this via SSI and php (this and this), but I have no experience with either of those, and would need some serious hand-holding to use them.

Is there any other way to do this, and if not, can someone provide some clear instructions and links to help me give it a try?

Thanks so much!
-Hilary
girlie
First: are both of these sites on the same server? If not, includes may not work at all for you, depending on what restrictions your host may have on the use of URLs rather than server paths in includes.

Second: if you don't want the knitting circle page run through MT, then yes, PHP and SSI are pretty much it for doing this.

Which leads to: you'll first want to find out whether or not your server supports one or both of these, and then we'll know where to go next.

It will be relatively painless, I promise. wink.gif
mellowmoose
Im trying to do the same so ill be keeping a close watch on this thread.

quick question how do i specify an output file ? Im creating a HTML output file and would i need to place that in the same directory as my weblog ?

thanks
craftyhilary
Yes, both sites are on the same server. On the other hand, this morning I had an epiphany about how to do this without SSI or PHP.

Here's what I did: create a new index page, formatted exactly like the web site where I wanted to include the recent category posts. Set it up to include only those posts. Let that page reside in the blog directory, so it would be able to function properly.

Then just link to that index page from my knitting circle page, so that it APPEARS seemlessly integrated into the site, although it isn't.

Let me know if that sounds kosher. Here's what it looks like:

Knitting circle page
new blog index with only last 3 entries in crafty category

I would still be very interested to learn the easy way to do this via PHP or SSI. My web host clearly supports PHP. I'm not sure about SSI, it isn't listed on the page.

Thanks,
Hilary
LisaJill
PHP is a form of ssi. SSI = server side include. php allows you to create these (of course its much more powerful than that, but anyway)

To convert your site to php to use this, here are instructions from the MTWiki on Converting To Php.

You'd also need your main pages (non blog ones) to be php, so it would be a matter of renaming them with the .php extension and deleting the other ones. Since you probably have an active site already you should check out the wiki and scroll down to where it says 'parsing html pages for php' - that way you wouldn't have to rename (no breaking links) and could still use php includes.

Then, it's just a matter of including the page that you want, like this


CODE
<?
include ("/path/to/includes/nameoffile.php");
?>


you'd have to replace the path ( can be absolute or relative, up to you - and of course the file name.

When you include a page it gets included as the full thing in the normal document flow - so you do NOT want head /head or body /body tags or anything like that, you want just the bare minimum code. So in MT you'd make your index template with just the MTEntries code you want to show - then php include that.

Does that help?
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.