Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Manually sort sections in article_custom
I have such code:
<ul><txp:article_custom limit="5000" form="sitemap" sort="Section asc, Title asc" /></ul>
It calls forms sitemap
:
<txp:if_different>
</ul><h3><txp:section title="1" link="1" /></h3><ul>
</txp:if_different>
<li><txp:permlink><txp:title /></txp:permlink></li>
The result you can see here
I want to sort sections output manully: articles,clinics,about – like this. But attr section
can handle only on section. I tried to use chh_article_custom
– it can see more than one entry in section attr. But it doesn’t sort articles by sections order in attr section
:(
If it doesn’t clear yet – i want something like this: <txp:article_custom section="articles,clinics,about" />
and this should output firstly articles from articles
sections, than clinincs
, and by end – about
sections.
Last edited by the_ghost (2008-01-14 08:48:32)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Manually sort sections in article_custom
why not just three article_custom tags?
Offline
#3 2008-01-14 09:02:43
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Manually sort sections in article_custom
<ul><txp:article_custom limit="5000" form="sitemap" sort="field(Section, 'articles','clinics','about'), Title asc" /></ul>
Offline
#4 2008-01-14 09:52:41
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Manually sort sections in article_custom
Wow Mary, this is great! Why did you devs keep this a secret? ;)
Offline
#5 2008-01-14 10:24:35
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Manually sort sections in article_custom
the_ghost wrote:
If it doesn’t clear yet – i want something like this:
<txp:article_custom section="articles,clinics,about" />
and this should output firstly articles fromarticles
sections, thanclinincs
, and by end –about
sections.
If I remember well this feature will be present in the next txp release (4.06) which I think will be out soon
Offline
#6 2008-01-14 10:33:15
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Manually sort sections in article_custom
It’s not really a dev secret, but a MySQL feature that’s apparently not very well known. It’s used in the core in a few places, and I use it in upm_image and upm_file.
Offline
#7 2008-01-14 16:25:28
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Manually sort sections in article_custom
Mary, thanks for explaining. I think I understand, is it the same (or similar) feature that is used in <txp:section_list sections="section3,section5,section1" />
?
Offline
Re: Manually sort sections in article_custom
Mary – does this restricts to entered sections or it only sorts them in a desired way?
Hm..
Els – i think you are right with comparison.
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Manually sort sections in article_custom
does this restricts to entered sections or it only sorts them in a desired way?
It’s at the sort
-attribute, as sort’s value. What would you think? ;)
It sorts the entered sections by that order.
Cheers!
Last edited by Gocom (2008-01-14 18:21:58)
Offline
Re: Manually sort sections in article_custom
Something is wrong :\ I tried entirely Mary’s example but it produces error:
tag_error <txp:article_custom limit="5000" form="sitemap" sort="field(Section, 'articles','clinics','about'), Title asc" /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'articles\',\'clinics\',\'about\'), Title asc limit 0, 5000' at line 1
select *, unix_timestamp(Posted) as uPosted from uro_textpattern as textpattern where 1 and Status = 4 and Posted <= now() order by field(Section, \'articles\',\'clinics\',\'about\'), Title asc limit 0, 5000 on line 84
Look here …
(Edit: changed bq.
to bc.
for better readability… -Els)
Last edited by els (2008-01-14 18:57:37)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#11 2008-01-16 10:41:35
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Manually sort sections in article_custom
Yes Els.
Crud, sort
gets slashed (forgot about that), so that won’t work.
Offline
Re: Manually sort sections in article_custom
Mary – is there way to solve this problem? I tried single quotes, double, slashes – nothing helps. :(
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline