Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-12-04 05:33:48

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

articles sort not works !

Hi,
I’m trying the following codes to have custom article list, when i add sort option, nothing appear and that place shows blank !


<txp:article_custom category="left-box" limit="3"  sort="Posted asc">
	<div class="logos">
		<h2><a href="<txp:permlink />"><txp:title /></a></h2>
		<a href="<txp:permlink />"><txp:article_image thumbnail="1" /></a>
	</div>
</txp:article_custom>

Note: actually i need to sort by custom field 2, that also not works, if i clear the sort option, everything will appear !


<txp:article ... sort="custom_5 asc" />

Offline

#2 2014-12-04 08:23:44

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: articles sort not works !

hi

post all the bloc code you are using, may be there is a syntax error somewhere!

Offline

#3 2014-12-04 15:16:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,223
Website GitHub

Re: articles sort not works !

Your code looks okay to me so this is just a wild guess: In your second example you close the txp:article tag with /> at the end which prevents the contained code from being executed. If you remove the slash, the container should work…


TXP Builders – finely-crafted code, design and txp

Offline

#4 2014-12-04 18:06:06

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: articles sort not works !

I think all my codes are fine, I’m using: Textpattern CMS · 4.5.7
Dragondz: although i put just the above codes on the blank page for testing and checked that, still can’t see anything, become a blank page :-(
Jakob: i know the second one is self-closed, even with that option i can’t see anything !
if i remove the sort option, then everything works fine …

Offline

#5 2014-12-04 19:35:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,395
Website GitHub Mastodon Twitter

Re: articles sort not works !

Hi raminrahimi

This is just stating the obvious but do you have a custom field named custom_5 or does it have another name for which case are you sure that you are spelling it right in the code?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2014-12-04 20:45:31

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles sort not works !

Switch to debug mode, then post the part of the HTML source that shows which SQL query results from your malfunctioning code.

Offline

#7 2014-12-05 08:45:47

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,801
GitHub

Re: articles sort not works !

I’m going to +1 colak’s suggestion and ask if you have any articles with the category left-box.

I’m also going to +1 ruud’s suggestion and recommend a tag trace in debug mode, which will show you what’s happening.

Offline

#8 2014-12-05 15:35:45

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: articles sort not works !

Yes, I’ve articles on that category already, no option of sort works fine even i do by id, posted, etc…
this is the debug result on the source:


<!-- Runtime:    0.0206 -->
<!-- Query time: 0.007706 -->
<!-- Queries: 7 -->
<!-- Memory: 2383Kb, end of textpattern() -->
<!-- txp tag trace: 
[SQL (0.00099301338195801): select name, data from xz9_txp_lang as txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.0024199485778809): select name, data from xz9_txp_lang as txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.0013928413391113): select name, code, version from xz9_txp_plugin as txp_plugin where status = 1 AND type IN (0,1,5) order by load_order]
[SQL (0.00036382675170898): select page, css from xz9_txp_section as txp_section where name = 'default' limit 1]
[SQL (0.00026202201843262): select user_html from xz9_txp_page as txp_page where name='default']
[Page: default]
<txp:article_custom category="left-box" limit="3" sort="Posted asc">
	[SQL (0.00089716911315918): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from xz9_textpattern as textpattern where 1=1 and Status = 4 and Posted <= now() and (Category1 IN ('left-box') or Category2 IN ('left-box')) and custom_2 like 'Posted asc'  order by Posted asc limit 0, 3]
</txp:article_custom>
[ ~~~ secondpass ~~~ ]
 -->

Offline

#9 2014-12-05 15:46:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,223
Website GitHub

Re: articles sort not works !

Could the problem be this bit:

… and custom_2 like 'Posted asc' …

I can’t see that in your txp:article tag, so maybe some other plugin is at work (or have you named custom field 2 “sort”)?


TXP Builders – finely-crafted code, design and txp

Offline

#10 2014-12-05 16:43:56

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

Re: articles sort not works !

jakob wrote #286276:

or have you named custom field 2 “sort”?

I’ll bet

Offline

#11 2014-12-05 16:58:23

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: articles sort not works !

yes solved the problem !
before i renamed the custom field name to “sort” !
now i renamed to “sort1” , it works perfect :-)

Offline

#12 2014-12-06 12:29:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles sort not works !

Perhaps this should be considered a bug… and certain custom_field names should be put on a black list. Or better, but not backwards compatible, don’t use the user-defined custom field names as tag attributes, but stick to custom_1 etc.

Offline

#13 2014-12-06 14:25:15

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,801
GitHub

Re: articles sort not works !

ruud wrote #286300:

Perhaps this should be considered a bug… and certain custom_field names should be put on a black list.

I seem to recall there were some words listed on the custom_field entry on the wiki, and this thread backs that up, but they don’t appear to be there any longer.

Edit – found it www.textpattern.net/wiki/index.php?title=Advanced_Preferences#Custom_Fields

Last edited by gaekwad (2014-12-06 14:26:51)

Offline

#14 2014-12-06 15:31:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles sort not works !

If it’s a known list of keywords, TXP can emit an error message and refuse invalid names, so the user doesn’t have to read the entire Wiki to find the cause for mysterious problems such as the one in this topic.

Offline

#15 2014-12-06 17:12:55

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: articles sort not works !

ruud wrote #286304:

If it’s a known list of keywords, TXP can emit an error message and refuse invalid names, so the user doesn’t have to read the entire Wiki to find the cause for mysterious problems such as the one in this topic.

Oh yes please! My signature is way too long ;)

Offline

Board footer

Powered by FluxBB