Help - Search - Members - Calendar
Full Version: Display Only Entries That Have A Category
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
roddy1369
just trying to figure out a way to list only entries that have been given a category. thanks!
caribou sue
Hi,
I haven't tested this, but you can give it a try! In theory, this would spit out entry titles if the category isn't blank. More info on MTIf here if it doesn't work: http://www.movabletype.org/documentation/a...es/tags/if.html

<MTEntries>
<MTIf tag="EntryCategory">
<MTEntryTitle>
</MTIf>
</MTEntries>
blog-coding-is-fun
QUOTE (caribou sue @ Jan 12 2009, 09:30 AM) *
Hi,
I haven't tested this, but you can give it a try! In theory, this would spit out entry titles if the category isn't blank. <snip>

<MTEntries>
<MTIf tag="EntryCategory">
<MTEntryTitle>
</MTIf>
</MTEntries>


I did test that and it does work.

Conversely, I needed all entries that didn't have a category -- or to be exact, all that had a specific category or were accidentally left blank. For that, I limited the results to the category or to things that matched the dumbest regular expression I ever wrote -- ^$, meaning the start & end of the category field, with nothing in the middle. If there's a better way to say, "empty field," feel free to tell me!

CODE
<mt:Entries>
    <mt:If tag="EntryCategory" like="(Category_Name|^$)">
    <mt:Include module="Entry Summary" />
    </mt:If>
</mt:Entries>

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.