Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-12-02 17:09:24
- CharlesCountyArtsAlliance
- New Member
- Registered: 2009-10-19
- Posts: 6
Trying to exclude one article in a list
On the site I’m building, I have a news section that contains 3 categories. I want two of these categories to appear in an article list (latest news) when the user first visits the section. The third category contains only one article, and since it will be a static “sub-section”, it should never appear in the list.
Article custom won’t work for me in this case because I want the list to have older/newer functionality. I found a plugin that seemed to do exactly what I needed— soo_article_filter— which allows for you to filter articles in a list based on certain criteria. In this case, I wanted to show every article that had static-article-order undefined. When I attempted to use it the page imploded on itself. TXP flat-out ignores the tag:
<txp:soo_article_filter static-article-order="">
and instead I get the article list, followed by the full versions of every article. TXP informs me that:
Tag error: <txp:else/> -> Textpattern Warning: tag does not exist on line 1120
Tag error: <txp:if_article_category name="press-releases"> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2175
This is probably because the code snippet in question reads:
<txp:if_article_list>
<txp:soo_article_filter static-article-order="">
<txp:article limit="7" form="article-list"/>
</txp:soo_article_filter>
<txp:older>◄ Older</txp:older> <txp:newer>Newer ► </txp:newer>
<txp:else/>
<txp:if_article_category name="press-releases">
<txp:article form="press-release"/>
<txp:else/>
<txp:article/>
TXP seems fine with <txp:soo_article_filter> until I try and sort by custom field, and I can’t figure out why. I disabled different plugins to see if something wasn’t playing nice, but that doesn’t seem to be the problem. And I’m not sure why the problem erupts only when I try and sort by a custom field. It’s very curious.
Here’s the tag trace. If anyone has an idea of what’s going screwy, or if they have a simpler way to solve the sort problem, I’d be very grateful.
<!-- Runtime: 0.2806 -->
<!-- Query time: 0.206026 -->
<!-- Queries: 44 -->
<!-- Memory: no info available -->
<!-- txp tag trace:
[SQL (0.0179460048676): select name, data from txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.0382070541382): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.0017101764679): select page, css from txp_section where name = 'news' limit 1]
[SQL (0.00216794013977): insert into txp_log set `time`=now(),page='/test_pages/new-site/index.php?s=news',ip='69.251.159.81',host='69.251.159.81',refer='',status='200',method='GET']
[SQL (0.0011248588562): select user_html from txp_page where name='section']
[Page: section]
<txp:output_form form="int-header"/>
[SQL (0.000838994979858): select Form from txp_form where name='int-header']
[Form: int-header]
<txp:site_name/>
<txp:output_form form="base-javascript"/>
[SQL (0.00133299827576): select Form from txp_form where name='base-javascript']
[Form: base-javascript]
<txp:output_form form="random-class"/>
[SQL (0.00267791748047): select Form from txp_form where name='random-class']
[Form: random-class]
<txp:search_input section="search" button="Go"/>
[SQL (0.000541925430298): select form from txp_form where `name` = 'search_input' limit 1]
<txp:link_to_home>
<txp:image id="3"/>
[SQL (0.00108098983765): select * from txp_image where id = 3 limit 1]
</txp:link_to_home>
<txp:section_list wraptag="ul" break="li" sections="about-us,programs,events,news,contact" include_default="1" default_title="Home" active_class="active"/>
[SQL (0.00088906288147): select name, title from txp_section where name in ('about-us','programs','events','news','contact') order by field(name, 'about-us','programs','events','news','contact')]
<txp:cbs_category_list parent='<txp:section />' wraptag="ul" break="li" />
[attribute 'parent']
<txp:section />
[/attribute]
[SQL (0.0020809173584): SELECT c.name, c.title FROM `txp_category` AS c, `textpattern` AS t WHERE (c.name = t.Category1 OR c.name = t.Category2) AND c.type = 'article' AND t.Section = 'news' AND c.parent = 'news' AND t.Posted < now() AND t.Status = 4 GROUP BY c.name ORDER BY c.title]
<txp:if_section name="search">
[<txp:if_section name="search">: false]
</txp:if_section>
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:article limit="7" form="article-list"/>
[SQL (0.00343704223633): select count(*) from textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('news')]
[SQL (0.00573086738586): 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 Section IN ('news') order by Posted desc limit 0, 7]
[article 28]
[SQL (0.00286197662354): select Form from txp_form where name='static-default']
[Form: static-default]
<txp:title/>
<txp:article_image class="article"/>
<txp:body/>
<txp:file_download_list label="Past Issues" labeltag="h2" sort="created asc" category="newsletters" wraptag="ul" break="li" />
[SQL (0.00397706031799): select * from txp_file where 1=1 and category IN ('newsletters') and status = '4' order by created asc limit 0, 10]
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 19]
[SQL (0.000788927078247): select Form from txp_form where name='article-list']
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
[SQL (0.0157420635223): select * from txp_image where id = 4]
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
[article 18]
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
[article 17]
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
[article 12]
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
[article 14]
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
[SQL (0.00498795509338): select * from txp_image where id = 5]
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
[article 13]
[Form: article-list]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:permlink>
<txp:article_image thumbnail="1"/>
</txp:permlink>
<txp:excerpt/>
<txp:permlink>
</txp:permlink>
</txp:if_article_list>
<txp:older>
</txp:older>
<txp:newer>
</txp:newer>
<txp:else/>
Tag error: <txp:else/> -> Textpattern Warning: tag does not exist on line 1120
<txp:if_article_category name="press-releases">
Tag error: <txp:if_article_category name="press-releases"> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2175
[<txp:if_article_category name="press-releases">: false]
<txp:article/>
[SQL (0.00232005119324): select count(*) from textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('news')]
[SQL (0.0146150588989): 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 Section IN ('news') order by Posted desc limit 0, 10]
[article 28]
[Form: static-default]
<txp:title/>
<txp:article_image class="article"/>
<txp:body/>
<txp:file_download_list label="Past Issues" labeltag="h2" sort="created asc" category="newsletters" wraptag="ul" break="li" />
[SQL (0.00858688354492): select * from txp_file where 1=1 and category IN ('newsletters') and status = '4' order by created asc limit 0, 10]
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 19]
[SQL (0.00122904777527): select Form from txp_form where name='default']
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
[SQL (0.00101590156555): select * from txp_image where id = 4]
<txp:author/>
[SQL (0.00411009788513): select RealName from txp_users where `name` = 'administrator' limit 1]
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.00253081321716): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2009-10-21 14:59:13' and Section = 'news' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.00209093093872): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:59:13' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:prev_title />
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00299596786499): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2009-10-21 14:59:13' and Section = 'news' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.0013108253479): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:59:13' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
[SQL (0.00981402397156): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 28]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 18]
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
<txp:author/>
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.00438094139099): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2009-10-21 14:56:17' and Section = 'news' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.00342106819153): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:56:17' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:prev_title />
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00735902786255): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2009-10-21 14:56:17' and Section = 'news' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.00157713890076): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:56:17' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 17]
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
<txp:author/>
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.00325202941895): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:53:16' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:prev_title />
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00104999542236): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-10-21 14:53:16' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 12]
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
<txp:author/>
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.0022759437561): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 13:30:12' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:prev_title />
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00156998634338): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 13:30:12' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 14]
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
[SQL (0.00329113006592): select * from txp_image where id = 5]
<txp:author/>
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.00480198860168): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 13:30:07' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:prev_title />
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00272703170776): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 13:30:07' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
[article 13]
[Form: default]
<txp:title/>
<txp:article_image class="article"/>
<txp:author/>
<txp:posted/>
<txp:body/>
<txp:link_to_prev>
[SQL (0.00326704978943): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 10:30:41' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
</txp:link_to_prev>
<txp:link_to_next>
[SQL (0.00174808502197): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-09-23 10:30:41' and Section = 'news' and Status=4 and Posted < now() order by Posted desc limit 1]
<txp:next_title />
</txp:link_to_next>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: false]
</txp:if_comments_allowed>
</txp:if_article_category>
[ ~~~ secondpass ~~~ ]
-->
Offline
Re: Trying to exclude one article in a list
Being away from the computer I’m finding it a challenge to read a tag trace ;)
I think the reason soo_article_filter isn’t filtering is that it can’t handle custom field names containing hyphens.
Also, add a space before the closing slash in else
.
Code is topiary
Offline
#3 2009-12-02 20:45:48
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Trying to exclude one article in a list
Tag error: <txp:else/> -> Textpattern Warning: tag does not exist on line 1120
You should close the if_ tags, like this:
<txp:if_article_list>
...
<txp:else />
...
</txp:if_article_list>
Tag error: <txp:if_article_category name=“press-releases”> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2175
<txp:if_article_category>
belongs in your article form, not on the page the way you used it.
Offline