You are not logged in.
Pages: 1
I have the need to use article_custom, but limit it to what is returned by two possible values that may be in a custom field. The custom field is a drop down using Gerhard’s Custom Fields has numerous names in it, but I only want articles written by Bill Smith or Dave Twain.
I have tried multiple variations of the following with no success, but have a feeling the answer is right under my nose.
<txp:article_custom sort="Posted desc" limit="3" Author="Bill Smith,Dave Twain" />
I cannot use seperate statements because I want the total number returned always to be three —-
Any assistance would be greatly appreciated.
progre55
Last edited by progre55 (2012-08-10 16:44:11)
Offline
So, it’s your custom field that’s named author, right? article_custom has its own attribute named author, so there’ll be a naming conflict.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Online
uli:
That is what I originally thought — and it may be true — but I tried the above changing Author to Writer and still unable to get it to work.
Offline
Yes, TXP expects the value to be exactly the content of the custom_field. So you’ve got to go the detour of putting two article_custom tags (one for each author), outputting article_ids, inside the id attribute of your article_custom tag. In theory ;)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Online
outputting article_ids, inside the id attribute of your article_custom tag
Not sure I know exactly what you mean —-
If my form reads like this
<txp:article_custom sort="Posted desc" limit="3" Writer="Bill Smith" />
<txp:article_custom sort="Posted desc" limit="3" Writer="Dave Twain" />
Not sure how I can get the articles to be a comination of the both to total 3 — have the three be the most recent — and have the most recent ones —- regardless of writer on top —-
Offline
In theory, not tested:
<txp:article_custom sort="Posted desc" limit="3" id='<txp:article_custom break="," Writer="Bill Smith"><txp:article_id /></txp:article_custom>,<txp:article_custom break="," Writer="Dave Twain"><txp:article_id /></txp:article_custom>' />
No need to limit or sort the inner article tags, the outer tag does all that.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Online
Not sure I mentioned that you’ve got to change the contents of your form ;)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Online
This is not a perfect solution ( used direct call custom_3 ), but …
<txp:aks_article sort="Posted desc" limit="3" where="custom_3 in ('Bill Smith', 'Dave Twain') " />
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly
Offline
makss:
Will definitely take a look at this ..
Thanks for the direction.
progre55
Offline
Here is another (untested) solution:)
<txp:variable name="writer1" value='<txp:article_custom break="," Writer="Bill Smith"><txp:article_id /></txp:article_custom>' />
<txp:variable name="writer2" value='<txp:article_custom break="," Writer="Dave Twain"><txp:article_id /></txp:article_custom>' />
<txp:article_custom limit="3" id='<txp:variable name="writer1" />,<txp:variable name="writer2" />' sort="posted desc">
...your containing statements
</txp:article_custom>
neme.org | neme-imca.org | hblack.net | LABS
Offline
Pages: 1