Help - Search - Members - Calendar
Full Version: MT tags on non-blog pages
Movable Type Community Forum > Additional Resources > Tips and Tricks
BubbleDragon
Hello! I'm bubbles and I run bubble-dragon.net. If you go there, you'll find that the blog is not the main index page, however there's a little slot reserved for a list of recent entries. So far I haven't played with it, but how would I get a list of recent entries (like appears on the left sidebar of my blog) into the index page?

I know you could do it with greymatter by setting permissions, but this file is also outside of the folder my blog is in, so I'm not sure what to do. Please help!

The only other solution I can come up with right now would be to create a simple text file within the blog folder, set permissions correctly, get the recent entries list, and then to use an include to put it on the index page, but I'm not even really sure how to do that.

I would love anyone would could help me greatly! :o)
mversion
The best way would be to use includes as you have thought of yourself. Hopefully your server has PHP installed and you are willing to rename your files with the .php extension.

If so, you could create a new index template. Name it, say, recent.php with the following code:

CODE
<MTEntries lastn="7">
<MTEntryDate format="%a %b %d">: <a alt="" title="<MTEntryExcerpt>" href="<$MTEntryLink$>"><$MTEntryTitle$></a><br>
</MTEntries>


And then on your main index (which should have the .php extension) you would use this code where you want the recent entries list to show:
CODE
<?php include("/home/bubble/public_html/blog/recent.php"); ?>


Just make sure the path to the recent.php file is set correctly. The above is just an example.

It might seem like pain having to change your file extensions to .php, but it is well worth it. There are other ways to use php with the .html extension, but I'd think that would be complicated for the time being.

Hope this helps.
BubbleDragon
Oh, wow, that helps bunches! :o)

I'll just put a redirect on index.html to index.php and rewrite some navigation. Shouldn't be too much of a hassle... I could do SSI, but I'd still have to rename to .shtm

Oh yeah, one more thing...
the recent.php would have to be in the blog folder, with all the permissions set as the other pages?

Thanks bunches,
~bubbles
mversion
There shouldn't be any permissions that you would have to set for the template file.

It will be placed in the blog folder by default. You can specify your own location if you want to in the output file box:

eg.
CODE
/home/domain/public_html/myincludes/recent.php


SSI is your other option for includes, but there will be so many things you'd want to do and find that PHP is the only way.
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.