Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-04-26 23:36:37
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
r1303: thisarticle changes
This one’s a doozy, consider it tentative. Could affect plugins, particularly article/archive list plugins.
Basically: On individual article pages, $thisarticle is now populated before template parsing begins, rather than when the txp:article tag is parsed. That means most article context tags should work in the page template on article pages (not list pages, for obvious reasons).
Also, txp:… tags in the article body and excerpt aren’t parsed until the txp:body or txp:excerpt tags are encountered. Previously they were parsed as each article was loaded, before the article form was parsed. This should speed up article lists that don’t display the excerpt or body. Again, it might affect plugins.
Oh, and it now should be possible to use <txp:article_custom />
inside an article body. Beware infinite loops.
Last edited by zem (2006-04-26 23:40:50)
Alex
Offline
Re: r1303: thisarticle changes
Are you definitely sure about that?
#401 $out['id_keywords'] = @$a['AuthorID'];
#402 $out['id_author'] = @$a['Keywords'];
//w&
Offline
#3 2006-04-27 07:12:12
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: r1303: thisarticle changes
Am I missing something? That part is from the old code, something (plugins?) might rely on it.
Alex
Offline
Re: r1303: thisarticle changes
This is an undeliberate mix of keywords and authors, IMHO.
$out[‘id_*keywords*’] = $a['*Author* ID'];
$out['id_*author*'] =
$a[‘Keywords’];
Old code was:
$out['id_keywords'] = $Keywords;
$out['id_author'] = get_author_name($AuthorID);
//w&
Last edited by wet (2006-04-27 07:31:06)
Offline
#5 2006-04-27 11:26:31
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: r1303: thisarticle changes
This is an undeliberate mix of keywords and authors, IMHO.
[slaps forehead]
Alex
Offline
#6 2006-04-28 00:59:35
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: r1303: thisarticle changes
Should be fixed in r1306. Thanks, well spotted.
Alex
Offline
Re: r1303: thisarticle changes
This changeset breaks the previous behaviour for sticky articles in single article pages.
Steps to reproduce
Change the default page template to list all ‘sticky’ articles before the ‘live’ ones by adding a second txp:article
tag:
[...]
<!-- center -->
<div id="content">
<txp:article status="sticky" /> <!-- HERE -->
<txp:article />
<txp:if_individual_article>
<p>
[...]
Defect
On a single article page, the article is rendered twice (once for every instance of txp:article
) though it is not marked as “sticky”.
Tag trace
<!-- txp tag trace:
[SQL (0.000793): select name from txp_txp_lang as txp_lang where lang='en-gb' limit 1]
[SQL (0.003983): select name, data from txp_txp_lang as txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.003559): select name, code, version from txp_txp_plugin as txp_plugin where status='1']
[SQL (2.600219): select ID,Section from txp_textpattern as textpattern where url_title like 'first-post' AND Section='oevp' limit 1]
[SQL (0.000494): select * from txp_txp_section as txp_section where name = 'oevp' limit 1]
[SQL (0.000474): select *, unix_timestamp(Posted) as uPosted from txp_textpattern as textpattern where ID='1' and Status in (4,5)]
[article 1]
[SQL (0.000898): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from txp_textpattern where Posted > '2006-04-15 15:57:00' and Section = 'oevp' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.135435): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from txp_textpattern where Posted < '2006-04-15 15:57:00' and Section = 'oevp' and Status=4 and Posted < now() order by Posted desc limit 1]
[SQL (0.115381): select user_html from txp_txp_page as txp_page where name='oevp']
[Page: oevp]
<txp:css/>
<txp:page_title/>
[SQL (0.000360): select Title from txp_textpattern as textpattern where ID = 1]
<txp:link_to_home>
<txp:sitename/>
</txp:link_to_home>
<txp:site_slogan/>
<txp:linklist wraptag="p" />
[SQL (0.000654): select Form from txp_txp_form as txp_form where name='plainlinks']
[Form: plainlinks]
[SQL (0.110760): select * from txp_txp_link as txp_link where 1 order by linksort ]
<txp:search_input label="Search" wraptag="p" />
[SQL (0.000288): select form from txp_txp_form where `name` = 'search_input' limit 1]
<txp:popup type="c" label="Browse" wraptag="p" />
[SQL (0.000768): select name,title from `txp_txp_category` where name != 'default' and type='article' order by name]
<txp:feed_link label="RSS" />
<txp:feed_link label="Atom" flavor="atom" />
<txp:article status="sticky" />
[SQL (0.000525): select *, unix_timestamp(Posted) as uPosted from txp_textpattern as textpattern where ID='1' and Status='5' limit 1]
[SQL (0.000359): select Form from txp_txp_form as txp_form where name='default']
[Form: default]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:posted/>
<txp:author/>
[SQL (0.000523): select RealName from txp_txp_users where `name` = 'robert' limit 1]
<txp:body/>
<txp:comments_invite wraptag="p" />
<txp:site_url/>
[SQL (0.000312): select Form from txp_txp_form as txp_form where name='comments_display']
[Form: comments_display]
<txp:comments/>
[SQL (0.000228): select Form from txp_txp_form as txp_form where name='comments']
[Form: comments]
[SQL (0.075128): select *, unix_timestamp(posted) as time from txp_txp_discuss as txp_discuss where parentid='1' and visible=1 order by posted asc]
<txp:message/>
<txp:comment_name/>
<txp:comment_time/>
<txp:comment_permlink>
</txp:comment_permlink>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: true]
<txp:comments_form/>
[SQL (0.000217): select Form from txp_txp_form where `name` = 'comment_form' limit 1]
<txp:comments_error/>
<txp:text item="name" />
<txp:text item="email" />
<txp:text item="message" />
<txp:comments_help/>
</txp:if_comments_allowed>
<txp:article/>
[Form: default]
<txp:permlink>
<txp:title/>
</txp:permlink>
<txp:posted/>
<txp:author/>
<txp:body/>
<txp:comments_invite wraptag="p" />
<txp:site_url/>
[Form: comments_display]
<txp:comments/>
[Form: comments]
[SQL (0.000294): select *, unix_timestamp(posted) as time from txp_txp_discuss as txp_discuss where parentid='1' and visible=1 order by posted asc]
<txp:message/>
<txp:comment_name/>
<txp:comment_time/>
<txp:comment_permlink>
</txp:comment_permlink>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: true]
<txp:comments_form/>
[SQL (0.000157): select Form from txp_txp_form where `name` = 'comment_form' limit 1]
<txp:comments_error/>
<txp:text item="name" />
<txp:text item="email" />
<txp:text item="message" />
<txp:comments_help/>
</txp:if_comments_allowed>
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:link_to_prev>
</txp:link_to_prev>
<txp:link_to_next>
</txp:link_to_next>
</txp:if_individual_article>
<txp:if_article_list>
[<txp:if_article_list>: false]
</txp:if_article_list>
[ --- secondpass --- ]
-->
//w&
Last edited by wet (2006-05-11 18:17:32)
Offline
Re: r1303: thisarticle changes
wet wrote:
This changeset breaks the previous behaviour for sticky articles in single article pages.
Defect
On a single article page, the article is rendered twice (once for every instance of
txp:article
) though it is not marked as “sticky”.
Hi wet,
I think the previous behaviour for sticky articles was the same as now (“defect”). Look at this thread and there is a solution, i think.
Last edited by maniqui (2006-05-11 18:46:53)
Offline
Re: r1303: thisarticle changes
That’s true, but the article is ‘live’, not ‘sticky’ so it doesn’t match my case. I crosschecked with a Textpattern release prior to this changeset. Same page template, different behaviours.
The error occurs because the article is in status ‘live’ but it is rendered with both txp:article
tags, ‘live’ and ‘sticky’ as well.
Last edited by wet (2006-05-11 18:53:34)
Offline
#10 2006-05-12 23:59:01
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: r1303: thisarticle changes
Alex is away (from home) for the month, so he may not be aware of the recent updates to this thread. I’ll make sure he knows when I talk to him next. :)
Offline
Re: r1303: thisarticle changes
May I have a hint whether I should audit my templates in greater depth for violating the proper use of txp:article
, or can I assume that the effect is caused by this changeset and leave the affected templates as-is?
Offline
#12 2006-05-24 22:42:19
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: r1303: thisarticle changes
I’m aware there’s an issue, but haven’t had a chance to look at it yet. I’m guessing you’re right, and the new code doesn’t quite handle sticky articles correctly.
Alex
Offline