Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2013-05-11 09:00:52
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
section list with one articles based submenu
…and sort articles by value in ‘custom field’.
my form:
<txp:section_list default_title='<txp:text item="Avaleht" />' include_default="1" sections="kontakt,kusi-hinda,tooted" wraptag="ul" break="">
<li<txp:if_section name='<txp:section />'><txp:if_search><txp:else /><txp:if_category><txp:else /><txp:if_author><txp:else /> class="active"</txp:if_author></txp:if_category></txp:if_search></txp:if_section>><txp:section title="1" link="1" />
<txp:article_custom section="tooted" sort="custom_2 asc" wraptag="ul" break="li"><txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:section_list>
not working my code. it doesn’t sort like i ment to and articles based submenu is under every section name
Last edited by Gallex (2013-05-11 09:01:16)
Offline
#2 2013-05-11 10:27:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: section list with one articles based submenu
Gallex wrote:
not working my code. it doesn’t sort like i ment to and articles based submenu is under every section name
So you only want the article submenu for section ‘tooted’? Try this:
<txp:section_list default_title='<txp:text item="Avaleht" />' include_default="1" sections="kontakt,kusi-hinda,tooted" wraptag="ul" break="">
<li<txp:if_section name='<txp:section />'><txp:if_search><txp:else /><txp:if_category><txp:else /><txp:if_author><txp:else /> class="active"</txp:if_author></txp:if_category></txp:if_search></txp:if_section>><txp:section title="1" link="1" />
<txp:variable name="section_in_list" value='<txp:section />' />
<txp:if_variable name="section_in_list" value="tooted">
<txp:article_custom section="tooted" sort="custom_2 asc" wraptag="ul" break="li"><txp:permlink><txp:title /></txp:permlink></txp:article_custom>
</txp:if_variable>
</li>
</txp:section_list>
I don’t see anything wrong with your sort attribute. If it still doesn’t work with this code, can you post a tag trace?
Offline
#3 2013-05-13 09:44:48
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: section list with one articles based submenu
thank’s els for correct code! but sorting still not working. my aim is to sort articles by adding numeric values (1,2,3..and so.) into custom field named ‘custom_2’.
<!-- Runtime: 0.0662 -->
<!-- Query time: 0.044596 -->
<!-- Queries: 23 -->
<!-- Memory: 6129Kb, <txp:image_info type="alt" wraptag="span" class="thumb-alt" /> -->
<!-- txp tag trace:
[SQL (0.0158629417419): select name, data from txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.00423812866211): select name, code, version from txp_plugin where status = 1 AND type IN (0,1,5) order by load_order]
[SQL (0.00733089447021): select ID,Section from textpattern where url_title = 'sisevoodrilauad' AND Section='tooted' and Status >= 4 limit 1]
[SQL (0.000743865966797): select page, css from txp_section where name = 'tooted' limit 1]
[SQL (0.000298976898193): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=5 and Status in (4,5)]
[Article 5]
[SQL (0.000492811203003): select host from txp_log where ip='90.190.223.64' limit 1]
[SQL (0.000576972961426): select user_html from txp_page where name='default']
[Page: default]
<txp:lang />
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:title />
<txp:section title="1" />
[SQL (0.000241994857788): select title from txp_section where name='tooted']
</txp:if_individual_article>
<txp:if_section name="default">
[<txp:if_section name="default">: false]
</txp:if_section>
<txp:if_section name='test,otsing,various,footer,tagasiside'>
[<txp:if_section name='test,otsing,various,footer,tagasiside'>: false]
</txp:if_section>
<txp:rsd />
<txp:if_section name="">
[<txp:if_section name="">: false]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:permlink />
</txp:if_individual_article>
</txp:if_section>
<txp:css format="link" media="" />
<txp:site_url />
<txp:site_url />
<txp:site_url />
<txp:output_form form="share_buttons" />
[SQL (0.000816106796265): select Form from txp_form where name='share_buttons']
[Form: share_buttons]
<txp:article_custom id="3" form="special" />
[SQL (0.000344038009644): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status >= 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and ID IN (3) order by field(id, 3) limit 0, 10]
[Article 3]
[SQL (0.00012993812561): select Form from txp_form where name='special']
[Form: special]
<txp:title />
<txp:body />
<txp:link_to_home />
<txp:output_form form="sidebar" />
[SQL (0.000138998031616): select Form from txp_form where name='sidebar']
[Form: sidebar]
<txp:section_list default_title='<txp:text item="Avaleht" />' include_default="1" sections="kontakt,kusi-hinda,tooted" wraptag="ul" break="">
[attribute 'default_title']
<txp:text item="Avaleht" />
[/attribute]
[SQL (0.000204086303711): select name, title from txp_section where name in ('kontakt','kusi-hinda','tooted') order by field(name, 'kontakt','kusi-hinda','tooted')]
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section title="1" link="1" />
<txp:variable name="section_in_list" value='<txp:section />' />
[attribute 'value']
<txp:section />
[/attribute]
<txp:if_variable name="section_in_list" value="tooted">
[<txp:if_variable name="section_in_list" value="tooted">: false]
</txp:if_variable>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section title="1" link="1" />
<txp:variable name="section_in_list" value='<txp:section />' />
[attribute 'value']
<txp:section />
[/attribute]
<txp:if_variable name="section_in_list" value="tooted">
[<txp:if_variable name="section_in_list" value="tooted">: false]
</txp:if_variable>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section title="1" link="1" />
<txp:variable name="section_in_list" value='<txp:section />' />
[attribute 'value']
<txp:section />
[/attribute]
<txp:if_variable name="section_in_list" value="tooted">
[<txp:if_variable name="section_in_list" value="tooted">: false]
</txp:if_variable>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: true]
<txp:if_search>
[<txp:if_search>: false]
<txp:if_category>
[<txp:if_category>: false]
<txp:if_author>
[<txp:if_author>: false]
</txp:if_author>
</txp:if_category>
</txp:if_search>
</txp:if_section>
<txp:section title="1" link="1" />
<txp:variable name="section_in_list" value='<txp:section />' />
[attribute 'value']
<txp:section />
[/attribute]
<txp:if_variable name="section_in_list" value="tooted">
[<txp:if_variable name="section_in_list" value="tooted">: true]
<txp:article_custom section="tooted" sort="custom_2 asc" wraptag="ul" break="li">
[SQL (0.000473976135254): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('tooted') order by custom_2 asc limit 0, 10]
[Article 7]
<txp:permlink>
<txp:title />
</txp:permlink>
[Article 9]
<txp:permlink>
<txp:title />
</txp:permlink>
[Article 5]
<txp:permlink>
<txp:title />
</txp:permlink>
[Article 10]
<txp:permlink>
<txp:title />
</txp:permlink>
[Article 6]
<txp:permlink>
<txp:title />
</txp:permlink>
</txp:article_custom>
</txp:if_variable>
</txp:section_list>
<txp:if_search>
[<txp:if_search>: false]
<txp:if_section name="kontakt">
[<txp:if_section name="kontakt">: false]
<txp:if_section name="tooooted">
[<txp:if_section name="tooooted">: false]
<txp:article status="sticky" />
[filterAtts accepted]
<txp:article limit="100" />
[filterAtts ignored]
[SQL (0.000136137008667): select Form from txp_form where name='default']
[Form: default]
<txp:if_article_list>
[<txp:if_article_list>: false]
<txp:title />
<txp:body />
<txp:images id="84" form="left" />
[SQL (0.000808000564575): select * from txp_image where id IN ('84') order by field(id, 84) ]
[SQL (0.000157117843628): select Form from txp_form where name='left']
[Form: left]
<txp:image_url />
<txp:image_info type="caption" />
[SQL (0.00048303604126): select title from txp_category where name='tooted' and type='image']
<txp:thumbnail />
<txp:image_info type="alt" wraptag="span" class="thumb-alt" />
<txp:images id="51" form="left" />
[SQL (0.000169992446899): select * from txp_image where id IN ('51') order by field(id, 51) ]
[Form: left]
<txp:image_url />
<txp:image_info type="caption" />
<txp:thumbnail />
<txp:image_info type="alt" wraptag="span" class="thumb-alt" />
<txp:images id="29" form="left" />
[SQL (0.000164031982422): select * from txp_image where id IN ('29') order by field(id, 29) ]
[Form: left]
<txp:image_url />
<txp:image_info type="caption" />
<txp:thumbnail />
<txp:image_info type="alt" wraptag="span" class="thumb-alt" />
<txp:images id="22" form="left" />
[SQL (0.000154972076416): select * from txp_image where id IN ('22') order by field(id, 22) ]
[Form: left]
<txp:image_url />
<txp:image_info type="caption" />
<txp:thumbnail />
<txp:image_info type="alt" wraptag="span" class="thumb-alt" />
<txp:if_article_image>
[<txp:if_article_image>: false]
</txp:if_article_image>
</txp:if_article_list>
</txp:if_section>
</txp:if_section>
</txp:if_search>
<txp:if_section name="default">
[<txp:if_section name="default">: false]
</txp:if_section>
<txp:article_custom id="4" form="special" />
[SQL (0.000294923782349): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status >= 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and ID IN (4) order by field(id, 4) limit 0, 10]
[Article 4]
[Form: special]
<txp:title />
<txp:body />
<txp:site_url />
[ ~~~ secondpass ~~~ ]
-->
Offline
Re: section list with one articles based submenu
Gallex wrote:
thank’s els for correct code! but sorting still not working. my aim is to sort articles by adding numeric values (1,2,3..and so.) into custom field named ‘custom_2’.
May be because custom_2
is not numeric field. Try to replace 1,2,3,...
by 001,002,003,...
or sort="custom_2+0 asc"
.
Online
#5 2013-05-13 10:22:09
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: section list with one articles based submenu
that’s it! sort="custom_2+0 asc"
works well. thank’s oleg
Offline
Re: section list with one articles based submenu
Gallex wrote:
that’s it!
sort="custom_2+0 asc"
works well. thank’s oleg
Just mind that <txp:link_to_prev/next
will not respect it, falling back to posted desc
order. If needed, you can use etc_link_to
instead.
Online