Help - Search - Members - Calendar
Full Version: Dynamic Filtering By Category (using Php/smarty)
Movable Type Community Forum > Using Movable Type > Entries and Archives
jc03
Hi,

I'm trying to implement category filtering into a blog with dynamic publishing.

I've seen other sites where you click on a category, and it then displays the website with the posts filtered by the category selected. The URL would then usually be something like http://www.blog.com/index.php?start=1&cat=1

I'm having trouble coding in the category variable....I could use something like the line below, but it doesn't take into account for when the cat variable hasn't been set.

<MTEntries lastn="4" offset="'$smarty.request.start'" category="'$smarty.request.cat'">

Any body know how to make this work? Your help would be greatly appreciated.

Thanks,
Joel
My blog: www.tealilyphotography.com/jc
Su-
I don't ever use dynamic publishing, so if this is really what you're after I can't be any help, but a few things seem odd to me:

QUOTE (jc03 @ May 23 2008, 01:59 AM) *
I've seen other sites where you click on a category, and it then displays the website with the posts filtered by the category selected. The URL would then usually be something like http://www.blog.com/index.php?start=1&cat=1

As in other Movable Type sites? (Link?)
Because it kind of seems like you're making this more complicated than it needs to be. Why would you not just use category archives for it? The category "filtering" is inherent to them rather than being applied as an argument to the Entries loop.

Regarding that "start" query parameter, it's totally unfamiliar. It's also an entirely separate process, ie. pagination. If you want to do that with MT using Smarty, you should have a look at the posts Chad Everett's done. Make sure to go through the related items at the bottom of that. He added onto the method in a few others entries.
There are also several pagination options in the plugin directory.
jc03
Thanks....I think you made a good point about using the in-built capabilities of Movable Type.

I'm trying to do what Chad has done, but I can't get it to work. So now I'm using the Category Archive template in MT with the tag: <MTEntries lastn="4" offset="'$smarty.request.start'">

however....while I can get the '$smarty.request.start' variable to pass into the page (as text), it doesn't seem to load into the MT Template Tag......

i.e. i think MT is translating '$smarty.request.start' literally....or as null.


Anyone know where there's a good explanation of how Chad has done his implementation for categories?
jc03
i figured out what was wrong.

In the following line:
<MTEntries lastn="4" offset="'$smarty.request.start'">

I was using ' instead of `.
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-2008 Invision Power Services, Inc.