Help - Search - Members - Calendar
Full Version: Last 10 minus current one?
Movable Type Community Forum > Additional Resources > Tips and Tricks
Evoir
Hello,

I am using MT as a news area of a larger website. You can see it in action here:  http://dev.citycarshare.org/about/news/

Those news items on that page are MT (more news at the bottom of the page)

The thing I am having trouble with is this: I want MT to not list the current News item you are reading in the list at the bottom. Currently I use the following code to get the added News items at the bottom of the page. Is there a way to do this and not show the one you are reading in that list? I am also doing this on the Individual Archive pages.

CODE
Other Recent News:
<MTEntries lastn="10">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
</MTEntries>


Thanks a bunch. We are going live tonight!
Evoir
Evoir
Also: Am I breaking licence agreement? Do I need to keep a link to MT? If so, will a text link suffice?
girlie
CODE
Other Recent News:
<MTEntries offset="1" lastn="10">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
</MTEntries>


Keep a link to MT; text link is fine.
Evoir
Thanks Girlie. smile.gif

It worked on the main index page, but not on the archive page. On the archive page it only shows the active page link and not the other one. IS there a way to achive this on the Individual Entry Archive page?

Working on the linkback. smile.gif
staggernation
You might actually be able to use the Compare plugin I just posted earlier today. Try this (after installing the plugin):
CODE
Other Recent News:
<MTEntries lastn="10">
<MTIfNotEqual a="[MTArchiveLink]" b="[MTEntryLink archive_type='Individual']">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
</MTIfNotEqual>
</MTEntries>

(On edit: Sorry, I guess that won't work—see below.)
girlie
Okay, so what is it you want on the archive page, a link to the previous entry?

CODE
Other Recent News:
<MTEntryPrevious><a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
</MTEntryPrevious>


I don't think you're going to get a listing of the previous 10 entries on the Individual Page unless you use some PHP to do it. There are some recent threads around here about that. I'll see if I can find anything.
staggernation
Oh, wait, you're right, that won't work in the first place, will it? From the original post it sounded like the MTEntries list was working but he just wanted to exclude one entry. Sorry for the confusion...
girlie
That's okay - I love that new plugin btw, just used it to solve another problem here.

smile.gif
Evoir
I want the links at the bottom of the individual archive pages to show all (or the last 10) of the links - not including the one News item you are reading.

Thanks again. It's a nice community here. smile.gif Nice software, too.
staggernation
OK, let's see. This is going to be as clear as mud, so bear with me.

1) Do you want, at the bottom of each individual archive page, the 10 entries that are most recent relative to the item archived on that page? I think that's what girlie was saying (and I was agreeing) you can't do without PHP or something.

2) Or do you simply want, at the bottom of each individual archive page, the 10 most recent entries that have appeared on the site? In other words, the same set of entries (except for the one you want to omit) would appear on the bottom of every page, regardless of when the individual entry archived on that page was posted? If that's what you want, then the code I posted above should work...

3) Except, there seems to be a bug (or maybe a feature??) whereby the MTArchiveLink tag doesn't work on Individual archives. I just posted a about this elsewhere.

4) That being the case, you could still accomplish this by using yet another plugin, Timothy Appnel's
SetVarBlock, in conjunction with the Compare plugin. Something like this:
CODE
<MTSetVarBlock name="this_id"><$MTEntryID$></MTSetVarBlock>
Other Recent News:
<MTEntries lastn="10">
<MTIfNotEqual a="[MTGetVar name='this_id']" b="[MTEntryID]">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
</MTIfNotEqual>
</MTEntries>

I'll try to test this at some point and see if it actually works...
Evoir
2) I want to show the last ten in relation to the newest, not in relation to the one being sown. I also want that list to omit the one that I am reading in full on that page. We just pushed the site live. http://www.citycarshare.org/about/news/

An example would be on this archive page:
http://www.citycarshare.org/about/news/archives/000001.shtml

at the bottom of the page there is a list of the last 10 entries, and in the list is the current entry. I'd like the list to NOT include the current entry, whatever it is.

Does that make sense?

And thanks, again. smile.gif
staggernation
OK, so if that's what you want to do, I think the code under 4) above should work, if you install both those plugins.

Sorry for the confusion. Since you have fewer than 10 total entries right now, it was just hard to tell from your site how you'd want the listing to behave once you have more than 10 entries.
Evoir
well, um, actually...  I hadn't thought about what happens after 10 entries. I think we'll have as many entries as we have in the blog, so if it went past ten, I'd change the number. Will it still work?
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.