Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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.


Code is topiary

Offline

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

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
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
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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?


Code is topiary

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
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
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
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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.


Code is topiary

Offline

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

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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.


Code is topiary

Offline

#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
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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).


Code is topiary

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

Board footer

Powered by FluxBB