Textpattern Forum

You are not logged in. Register | Login | Help

#11 2010-12-09 15:43:30

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

Re: Output sticky articles first in an article list

Thank you Jeff but as I can’t figure out how many articles I will have + iterating over the whole db isn’t bullet proof unfortunately, as you suggested as well…

Damm !

Help !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#12 2010-12-09 16:09:16

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

Re: Output sticky articles first in an article list

Just tested my code and it doesn’t work. Have to initialize the variable first. I’ve edited the post so that the code now works.

Last edited by jsoo (2010-12-09 16:09:35)


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

Offline

#13 2010-12-09 17:24:03

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

Re: Output sticky articles first in an article list

Also updated soo_article_filter with new attributes to reduce its memory footprint. Allowing this:

<txp:soo_article_filter article_image="1" limit="1" where="Status=4" sort="Posted desc">
    <txp:article />
</txp:soo_article_filter>

as a lightweight solution to your problem.


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

Offline

#14 2010-12-09 17:29:15

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

Re: Output sticky articles first in an article list

jsoo,
wonder if your discovering would be helpful in this situation?

If I recall correctly, it’s possible to use article_image as a txp:article_custom attribute, like if it were another custom field… So, article_image="_%" may do the trick of just selecting articles with images assigned… Someone will have to test it…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2010-12-09 17:32:31

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

Re: Output sticky articles first in an article list

Thank you very much Jeff.
I second Julian if there’s another way to go, such as revealed in the other thread mentioned…
As for now doing it the Txp native way doesn’t allow to insert other article calls between the if_article_image tags and is rather a hardcore method.

Here’s Jsoo last 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>
			// article output tags here
			<txp:variable name="art_img" value="1" />
		</txp:if_article_image>
	</txp:if_variable>
</txp:article>

Last edited by hablablow (2010-12-09 17:49:59)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#16 2010-12-09 18:18:25

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

Re: Output sticky articles first in an article list

maniqui wrote:

If I recall correctly, it’s possible to use article_image as a txp:article_custom attribute, 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?


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

Offline

#17 2010-12-09 18:35:01

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

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__

Hablablow + Webdesignofficina

Offline

#18 2010-12-09 18:37:59

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

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…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#19 2010-12-09 18:46:15

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

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.


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

Offline

#20 2010-12-09 18:51:10

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

Re: Output sticky articles first in an article list

maniqui wrote:

what about trying to sort like this: sort="Posted desc, Image" or sort="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.


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

Offline

Board footer

Powered by FluxBB