You are not logged in.
Gocom’s right, it pulls out a maximum of 3 fields and then looks at the custom field contents. If all of them happen to have video_id set, you’re good to go. If not, you’ll see fewer articles.
artagesw’s solution is by far the simplest, but if you’re already using the categories for other things you’re stuck with Gocom’s “grab all articles and filter using txp:variables/smd_if”, some PHP or a one-stop smd_query. fwiw, off the top of my head, this should work:
<txp:smd_query query="SELECT * FROM textpattern WHERE video_id != '' ORDER BY Posted desc LIMIT 3">
<a href="/{Section}/{url_title}">{Title}</a>
</txp:smd_query>
EDIT: fix braindead 1st attempt
Last edited by Bloke (2009-07-03 09:35:15)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Online
Thanks everybody for your feedback. Manqui, I had the same thought you did but then realized the videos have different and totally unrelated ids. They are posted on different services (google, youtube, etc.) and I’m using the the_video plugin to embed them. If they were all on the same service and ids were assigned consecutively, conceivably I’d then simply be able to sort by id. But alas, that is not the case.
I was hoping to avoid having to assign a category, but it looks like this may be the only way for now (that doesn’t bog down the site, as Gocom pointed out). Thanks all!
Offline
alannie wrote:
I was hoping to avoid having to assign a category, but it looks like this may be the only way for now (that doesn’t bog down the site, as Gocom pointed out).
Or try this plugin: no category required; not boggy.
Edit: Okay, having looked a little closer at Gocom’s post, I should qualify: not too boggy, at least not for most tastes. Does involve some extra queries, so not a solution if primo performance is a goal. But hardly noticeable in the context of a typical Txp install.
Last edited by jsoo (2009-07-03 14:44:08)
Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.
Offline
jsoo wrote:
Or try this plugin: no category required; not boggy.
Wow!! You are fast – great documentation already in place too! I installed the plugin and it works beautifully. No noticeable bogginess as you predicted.
I’m a huge fan of your plugins and have soo_toc and soo_image installed as well. When are you adding a “Donate” button on your site? :)
Offline
jsoo wrote:
try this plugin
Thanks, Jeff!
I was just about to gather my poor English and put up a plugin request. I had several sites where I could need exactly this. Each solved in the meantime, but I’m sure this here will get its chance!
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Bloke wrote:
artagesw’s solution is by far the simplest, but if you’re already using the categories for other things you’re stuck …
If you don’t want to burn categories for this, keywords provide another alternative.
Offline
alannie wrote:
I’m a huge fan of your plugins and have
soo_tocandsoo_imageinstalled as well. When are you adding a “Donate” button on your site? :)
Thanks alannie, very kind! I suppose if my plugin download rate and/or support thread traffic goes way up I’ll consider it, but for now I’m happy to share these plugins that I am finding useful myself. Of course, a donation to Txp is always welcome…
Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.
Offline
Hmm, I’m taking the long way round to find a simple solution, as usual. Guess what:
<txp:article_custom limit="3" video_id="_%" />
works. Might just have to mothball that plugin.
Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.
Offline
^^ what?! _% works like a wildcard? do you know the explanation?
jsoo, thanks for sharing this discovery…
Offline
See the ‘like’ function in MySQL, about a page down describes the wildcards. "%" is the equivalent of ".*" in PCRE syntax. "_" is the equivalent of ".". So "_%" is equivalent to ".+".
Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.
Offline