Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Output sticky articles first in an article list
maniqui wrote:
If I recall correctly, it’s possible to use
article_imageas atxp:article_customattribute, like if it were another custom field…
I had the same recollection, and yet I can find no reference for it, nor does it seem to work.
Tag error: <txp:article_custom article_image=""> -> Textpattern Notice: Unknown tag attribute: article_image on line 743
hablablow wrote:
As for now doing it the Txp native way doesn’t allow to insert other article calls between the if_article_image tags
I guess I have misunderstood what you’re trying to do. Can you explain more fully?
Code is topiary
Offline
Re: Output sticky articles first in an article list
Jeff I’m simply adding an article call inside the if_article_image… And that doesn’t work whereas <txp:title /> will.
I’m embarrassed since I need this article call….
Such as this:
<txp:variable name="art_img" value="" /> <!-- Edit: need to initialize the variable -->
<txp:article limit="9999">
<txp:if_variable name="art_img" value="">
<txp:if_article_image>
<txp:article form="some_form" limit="1" section="ladies" category='<txp:category />' />
<txp:variable name="art_img" value="1" />
</txp:if_article_image>
</txp:if_variable>
</txp:article>
Last edited by hablablow (2010-12-09 18:35:31)
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: Output sticky articles first in an article list
jsoo wrote:
I had the same recollection, and yet I can find no reference for it, nor does it seem to work.
Tag error: <txp:article_custom article_image=""> -> Textpattern Notice: Unknown tag attribute: article_image on line 743
Looking at the DB, it seems the field is named “Image”, wonder if Image="_%" or "image="_%" could work.
Also, what about trying to sort like this: sort="Posted desc, Image" or sort="Image, Posted desc". Althought, in most common situations, this usually doesn’t help too much, as sorting isn’t exactly like filtering out…
Offline
Re: Output sticky articles first in an article list
article within article doesn’t make sense. (And section and category aren’t valid attributes for article.) You can use article_custom inside article.
Code is topiary
Offline
Re: Output sticky articles first in an article list
maniqui wrote:
what about trying to sort like this:
sort="Posted desc, Image"orsort="Image, Posted desc".
Neither will get the desired article in this case, the most recent article with an assigned image. Your first example will still return the most recent article first, whether or not it has an image. Your second example gets closer, but will sort in order of image ID.
Code is topiary
Offline
Re: Output sticky articles first in an article list
Of course Jeff… Sorry for the typo… Tested with the correct values and it outputs nothing.
Tested Julian’s solution and as you pointed it doesn’t work either…
:(
Last edited by hablablow (2010-12-09 18:56:53)
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: Output sticky articles first in an article list
I suspect the problem is your use of category. I think this needs to be category1 or category2 (and if you want to use either category you’ll need something more complicated).
Code is topiary
Offline
Re: Output sticky articles first in an article list
The point is, Jeff that it’s working unless that image-less article is the most recent article…
Here’s the snippet:
<txp:variable name="art_img" value="" /> <!-- Edit: need to initialize the variable -->
<txp:article limit="9999">
<txp:if_variable name="art_img" value="">
<txp:if_article_image>
<txp:article_custom form="some_form" limit="1" section="ladies" category='<txp:category />' />
<txp:variable name="art_img" value="1" />
</txp:if_article_image>
</txp:if_variable>
</txp:article>
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: Output sticky articles first in an article list
Just received your message while posting mine and tried it with category1, it’s even worse as it outputs nothing.
For now the best solution is the one mentioned above but it still outputs the article-less body and of course no image…
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: Output sticky articles first in an article list
I’m a bit lost about what you are trying to achieve (of course, I’ve just skimmed over the thread).
Please, could you try to provide the logic you are trying to apply in pseudo-code (not TXP code)?
Also, if not achievable by TXP built-in core tags, jsoo already suggested you could try using a plugin…
Offline
Re: Output sticky articles first in an article list
Sorry I haven’t been able to help you solve this — I still really do not understand exactly what it is you’re trying to achieve. At first I thought you wanted this:
- If there are any sticky articles, display the first sticky article.
- But if there are no sticky articles, display the most recent article that has an assigned image.
I don’t know what the purpose of the article_custom tag is. I don’t know what parts of the article with an assigned image you want to show. Can you explain it in general terms?
Code is topiary
Offline
#27 2010-12-09 20:14:16
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Output sticky articles first in an article list
hablablow wrote:
<txp:variable name="art_img" value="" /> <!-- Edit: need to initialize the variable -->
<txp:article limit="9999">
<txp:if_variable name="art_img" value="">
<txp:if_article_image>
<txp:article_custom form="some_form" limit="1" section="ladies" category='<txp:category />' />
<txp:variable name="art_img" value="1" />
</txp:if_article_image>
</txp:if_variable>
</txp:article>
That doesn’t look like it’s even supposed to work ;) What is the <txp:article_custom form="some_form" limit="1" section="ladies" category='<txp:category />' /> supposed to display? In other words, what is in form ‘some_form’?
And this:
<txp:variable name="art_img" value="" />
...
<txp:if_variable name="art_img" value="">
will of course always return true :)
Last edited by els (2010-12-09 20:16:34)
Offline
Re: Output sticky articles first in an article list
Els wrote:
will of course always return true :)
For the first article, yes. Then it will evaluate the if_article_image block, which is capable of changing the value of the variable.
Code is topiary
Offline
Re: Output sticky articles first in an article list
Julian, I’m trying to do just what Jeff mentions:
1 – If there are any sticky articles, display the first sticky article.
2 – But if there are no sticky articles, display the most recent article that has an assigned image.
1 – Solved
2 – …
Now what’s the purpose of the second article call or what’s inside the article_custom form…
Custom field conditionnals, titles and body, the usual stuff.
Except this: I’m using inside this form upm_article_image tags to get various options the regular article_image doesn’t provide…
And ‘this’ is not working. I have all my elements except the images :(
OK.
To make it simple:
Context: this only happens when we have an article list, on the home page or in an article_list.
Scenario: user has not entered his image id yet and saves the article. As long as the image id is not specified the article doesn’t show up, nowhere.
Logic: If article has no image, skip to the next article that has one.
Hope it makes sense.
Thank you very much guys for your help !
Should we open another thread for this one, as the original question is solved ?
Last edited by hablablow (2010-12-09 20:53:25)
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
Re: Output sticky articles first in an article list
You’re saying everything works except the output of upm_image tags? You’re getting the correct title, body, etc. from the latest article with an assigned image? Are you using Txp 4.3.0? If so, what happens if you put a regular article_image tag in the form?
Code is topiary
Offline