Textpattern Forum

You are not logged in. Register | Login | Help

#21 2010-12-09 18:56:10

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

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__

Hablablow + Webdesignofficina

Offline

#22 2010-12-09 19:33:02

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

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).


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#23 2010-12-09 19:34:20

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

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__

Hablablow + Webdesignofficina

Offline

#24 2010-12-09 19:39:32

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

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__

Hablablow + Webdesignofficina

Offline

#25 2010-12-09 19:56:16

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,967
Website

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…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#26 2010-12-09 19:56:43

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

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?


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#27 2010-12-09 20:14:16

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,374
Website

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)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#28 2010-12-09 20:29:24

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

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.


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#29 2010-12-09 20:47:06

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

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__

Hablablow + Webdesignofficina

Offline

#30 2010-12-09 21:29:53

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

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?


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

Board footer

Powered by FluxBB