Help - Search - Members - Calendar
Full Version: individual last 5 entries by MT tag
Movable Type Community Forum > Additional Resources > Tips and Tricks
holiday
Is there a MT tag to bring up any one of the last 5 entries as they change?
Cheers.
smile.gif
maddy
I'm not that clear on what you actually want. This code will display links (to the individual entry archive) of the last 5 entries. Is that what you want?
CODE
<MTEntries lastn="5">
<a href="<MTEntryLink archive_type="Individual">"><MTEntryTitle></a>
</MTEntries>


If that's not what you wanted, can you please clarify exactly what it is that you do want?
holiday
I am already aware of the tag that will display last 5 entries, however I need to link to them seperatly as I am using that information in conjunction with javascript.

Nomatter how many new entries I always need to reference only the current last 5 entries and they need to be individually accessed (all 5 on seperate lines in the javascript code).

Think of a drop down list box in javascript. Each archive link would have to be on it's own line in order to appear, each would have to link to it's respective entry.

I only actually need the title of the last 5 entries with their respective link to entries.

I hope that explains it's better.
Thanks.
smile.gif
charle97
use a series of lastn="1" s and offsets.
Lummox JR
MTEntries with lastn="5" would still be the way to go here; I'm not sure I see what wouldn't work. To set that up you'd just need something like this:
CODE
<MTEntries lastn="5">
 <option value="<$MTEntryPermalink$>"><$MTEntryTitle$></option>
</MTEntries>

Lummox JR
holiday
Hmm..I'm thinking about charle's suggestion.

What does "offset" mean?

I'm thinking if I can do something like last 5 entries=#1, #2, #3, etc. So I can specify #1, #2, #3, etc. in the javascript.
charle97
QUOTE
offset=``M''
When used with lastn (above), starts M entries from the most recent, then displays the N most recent posts. For example, if you use the following tag:

CODE
<MTEntries lastn="5" offset="5">
...
</MTEntries>


this will display entries 6-10 (inclusive).

NOTE: this only works when used with lastn.
kadyellebee
So why doesn't Lummox's suggestion work? It will make a single line for each javascript value - everything inside the MTEntries container will be repeated for each entry.

But if the offset would help you more, here's the format:
CODE
<MTEntries lastn="1">
code goes here for latest entry
</MTEntries>
<MTEntries lastn="1" offset="1">
code goes here for next to latest
</MTEntries>
<MTEntries lastn="1" offset="2">
code goes here for 3 entries back
</MTEntries>
and so on...


Kristine
holiday
Right, I get it. OK I'm gonna try it out.
Essentially I have to place a tag where I would normally place a url in the javascript.
I'll let you know the success of it.
Thanks all.
Lummox JR
Keep in mind, the MT tags are evaluated at build time, but the JavaScript is not. Basically what you're doing is using MT to build JavaScript, not vice-versa. (To use JavaScript to build MT tags you'd basically need to activate mt-view.cgi and use that somehow. Not a great idea, and PHP would be the better choice for that.)

Lummox JR
holiday
OK now...

I have my main index page with a link to an external .js file which displays data in a certain format.

Also in my main index page I have method to enter the data to be formatted. Here is an example:

d.add(8,1,'mylastpost','example01.html');

"8" defines where the data shows in succesion (1,2,3,4,etc.) "1" is a sub succesion, "mylastpost" is the name of the link that appears on my main page, this is followed by the url link (example01.html).

Now with the MTEntries tag contains both the entry title name and the link url. So I need to seperate the name of the entry title and the url so I can put it into two fields.

I also need to do the same with my monthy archives.

Of course I could link it all manually but it wouldn't update when I update my blog.

would the MTEntryPermalink help me in any way?

Thanks for the help. This is my last challenge in completing my blog.
holiday
I'd hate bump this but I'm hoping to find a solution today so I can finish my blog (finally, heh heh)
smile.gif
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.