Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Re: Output sticky articles first in an article list
I wish I would use the v.3 but as it has more power on images but for for now I’m using v.2…
_
_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’d really like to use your plugin but I’m trying to filter a very special case here and I’m concerned about memory usage….
Last edited by hablablow (2010-12-09 21:49:51)
_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__
Offline
#33 2010-12-09 21:48:35
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Output sticky articles first in an article list
jsoo wrote:
For the first article, yes. Then it will evaluate the
if_article_image
block, which is capable of changing the value of the variable.
Oh yes, sorry, I missed the second txp:variable tag… now I understand your code, Jeff. But I don’t see how the article_custom tag in there could display the right article… I think you need to replace it with just the content of the form.
Offline
Re: Output sticky articles first in an article list
I know Els but then I will miss the upm_article_image… The image will not appear….
Last edited by hablablow (2010-12-09 21:51:45)
_
_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
hablablow wrote:
I know Els but then I will miss the upm_article_image… The image will not appear….
Obvious question is: is this a upm_image
issue then? What output do you get if the selected article has only one image assigned, and you use a regular article_image
tag?
Code is topiary
Offline
#36 2010-12-10 00:28:06
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Output sticky articles first in an article list
I think we might understand better why things don’t work for you if we knew the full code you are using…
Offline