Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Very strange behavior inside if_individual_article
Howdy,
I have a site that uses a small javascript for the comments that has to load just before the closing body tag. I was trying to be clever and display the script only on pages that actually have comments. No problem, right? Textpattern tag txp:if_comments
at your service. Since I’m calling it from the footer form, I have to wrap it in txp:if_individual_article
to give it the proper context.
When I added these conditionals, the script disappeared from rendered pages (with comments), so I looked at the tag trace, and saw this:
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:if_comments>
[<txp:if_comments>: false]
</txp:if_comments>
</txp:if_individual_article>
For some reason, Textpattern thinks there are no comments, even though there are clearly comments on the page, and earlier in the document (the comments_display form) it evaluates the same conditional as true
. Puzzling.
But friends, it gets stranger.
Just to see if I could get some additional information, I added a txp:title
tag in there before the opening if_comments
, to make sure it outputs an article title. So my code looks like this:
<txp:if_individual_article><txp:title /><txp:if_comments><script type="text/javascript">
$my-comments-display-script;
</script></txp:if_comments></txp:if_individual_article>
When I reload the URL in my browser, I see that Textpattern has replaced the txp:title
tag with the title of a different article in the same section.
What?
I looked at a couple of pages in that section and here’s the pattern:
- Article id 1 outputs the title of Article id 2 in the footer.
- Article id 2 output the title of Article id 3 in the footer.
- The latest Article outputs the title of Article id 1 in the footer.
So Textpattern was correct in evaluating if_comments based on the article title it was showing, but I can’t discern why it isn’t showing the same article info as further up on the same page.
What’s up?
Offline
#2 2009-04-29 21:16:10
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Very strange behavior inside if_individual_article
Hmm… intriguing! :) Would you mind posting the entire tag trace?
Offline
Re: Very strange behavior inside if_individual_article
Here it is! It’s a doozy, though. The portion referred to above is at the deep bottom.
<!-- txp tag trace:
[SQL (0.0279409885406): select name, data from txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.00423502922058): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.000393867492676): select name,code,version from txp_plugin where status = 1 AND name='smd_lib']
[SQL (0.000361919403076): select title from txp_section where name='wrote']
[SQL (0.00174903869629): show columns from smd_tags]
[SQL (0.000976085662842): select name,val,html from txp_prefs where name IN ('smd_tag_u_sec','smd_tag_u_pnam','smd_tag_u_ptyp') ORDER BY name]
[SQL (0.000419139862061): select ID,Section from textpattern where url_title like 'testy' AND Section='wrote' and Status >= 4 limit 1]
[SQL (0.000226020812988): select page, css from txp_section where name = 'wrote' limit 1]
[SQL (0.000371932983398): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=111 and Status in (4,5)]
[article 111]
[SQL (0.000530004501343): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2009-04-19 16:32:05' and Section = 'wrote' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted asc limit 1]
[SQL (0.000480890274048): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2009-04-19 16:32:05' and Section = 'wrote' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted desc limit 1]
[SQL (0.000355005264282): select host from txp_log where ip='::1' limit 1]
[SQL (0.0272979736328): insert into txp_log set `time`=now(),page='/wrote/testy',ip='::1',host='::1',refer='',status='200',method='GET']
[SQL (0.000513076782227): select name,type,IFNULL(unix_timestamp(file_mod_time), 0) as mod_time from txp_form where 1=1]
[SQL (0.000504970550537): update txp_form set form = '\n<div id=\"site-info\">\n <h4>Site Utilities</h4>\n <txp:cbs_navigation_menu\n sections=\"site-map,go,help\"\n titles=\"Site Map,Contact,Help!\"\n accesskeys=\"s,9,0\"\n break=\"li\"\n activeclass=\"active\"\n wraptag=\"ul\"\n />\n \n <h4>Colophon</h4>\n <ol>\n <li><a href=\"http://designop.us/\">Design Opus</a> is</li>\n<txp:hide> <li>made on <a href=\"http://apple.com/\">Macintosh</a>,</li></txp:hide>\n <li>hand-coded in <a href=\"http://macromates.com/\">Textmate</a>,</li>\n <li>hosted by <a href=\"http://www.tigertech.net/cgi-bin/referhosting.cgi?aa-designop.us\">Tiger</a>,</li>\n <li>published with <a href=\"http://textpattern.com/\">Textpattern</a>,</li>\n <li>and powered by Meaning.</li>\n </ol>\n <p>All content © copyright <txp:php>echo date(\'Y\');</txp:php> by <cite>John Stephens</cite> unless otherwise cited. <em>Design Opus</em>℠ and the compass rose <txp:image id=\"13\" /> are service marks ℠ of John Stephens.</p>\n <div id=\"bottom\"><a href=\"#nav\" title=\"Jump to the page top\">Top</a></div>\n</div>\n<txp:if_individual_article><txp:title /><txp:if_comments><script type=\"text/javascript\"> \n $(\'blockquote.message\').append(\'<span class=\"arrow\" />\'); \n</script></txp:if_comments></txp:if_individual_article>\n<script type=\"text/javascript\">\nvar gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src=\'\" + gaJsHost + \"google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker(\"UA-2550153-1\");\npageTracker._trackPageview();\n} catch(err) {}</script>\n</body>\n</html>\n\n\n', file_mod_time = FROM_UNIXTIME('1241048502') where name = '_site-info' AND type = 'misc']
[SQL (0.000235080718994): select name,IFNULL(unix_timestamp(file_mod_time), 0) as mod_time from txp_page where 1=1]
[SQL (0.00028395652771): select name,IFNULL(unix_timestamp(file_mod_time), 0) as mod_time from txp_css where 1=1]
[SQL (0.000166893005371): select user_html from txp_page where name='default']
[Page: default]
<txp:output_form form="_metas" />
[SQL (0.000307083129883): select Form from txp_form where name='_metas']
[Form: _metas]
<txp:site_name />
<txp:site_url />
<txp:php>
</txp:php>
<txp:mg_txpversion />
<txp:output_form form="_vars" />
[SQL (0.000235080718994): select Form from txp_form where name='_vars']
[Form: _vars]
<txp:variable name="site_author" value="John Stephens" />
<txp:variable name="site_keywords" value="designer, john stephens, identity, community, visual storytelling, social entrepreneurs, simplicity, clarity, meaningful media, web design" />
<txp:variable name="site_search-url" value='<txp:site_url />finds/' />
[attribute 'value']
<txp:site_url />
[/attribute]
<txp:variable name="site_feedback-email" value="info@designop.us" />
<txp:variable name="site_map-url" value='<txp:site_url />site-map/' />
[attribute 'value']
<txp:site_url />
[/attribute]
<txp:variable name="has_spotlight-content" value='<txp:article_custom section="made" category="spotlight" limit="1"><txp:article_id /></txp:article_custom>' />
[attribute 'value']
<txp:article_custom section="made" category="spotlight" limit="1">
[SQL (0.000710010528564): 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 (Category1 IN ('spotlight') or Category2 IN ('spotlight')) and Section IN ('made') order by Posted desc limit 0, 1]
[article 109]
<txp:article_id />
</txp:article_custom>
[/attribute]
<txp:variable name="has_spotlight-image" value='<txp:article_custom section="made" category="spotlight" limit="1"><txp:custom_field name="projects_spotlight-img-id" /></txp:article_custom>' />
[attribute 'value']
<txp:article_custom section="made" category="spotlight" limit="1">
[SQL (0.000681161880493): 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 (Category1 IN ('spotlight') or Category2 IN ('spotlight')) and Section IN ('made') order by Posted desc limit 0, 1]
[article 109]
<txp:custom_field name="projects_spotlight-img-id" />
</txp:article_custom>
[/attribute]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:variable name="has_excerpt" value='<txp:excerpt />' />
[attribute 'value']
<txp:excerpt />
[/attribute]
<txp:variable name="has_keywords" value='<txp:keywords />' />
[attribute 'value']
<txp:keywords />
[/attribute]
<txp:variable name="modified" value='<txp:modified format="%Y-%m-%d" />' />
[attribute 'value']
<txp:modified format="%Y-%m-%d" />
[/attribute]
<txp:variable name="has_next" value='<txp:link_to_next />' />
[attribute 'value']
<txp:link_to_next />
[/attribute]
<txp:variable name="has_prev" value='<txp:link_to_prev />' />
[attribute 'value']
<txp:link_to_prev />
[SQL (0.000268936157227): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 110]
[/attribute]
</txp:if_individual_article>
<txp:if_article_list>
[<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_search>
[<txp:if_search>: false]
</txp:if_search>
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:title no_widow="0" />
<txp:custom_field name="subtitle" />
</txp:if_individual_article>
<txp:hide>
</txp:hide>
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:wet_if_sticky>
[SQL (0.000181198120117): select Status from textpattern where ID = '111']
[<txp:wet_if_sticky>: false]
</txp:wet_if_sticky>
</txp:if_individual_article>
<txp:variable name="site_author" />
<txp:php>
</txp:php>
<txp:variable name="site_author" />
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:wet_if_sticky>
[SQL (0.000288009643555): select Status from textpattern where ID = '111']
[<txp:wet_if_sticky>: false]
</txp:wet_if_sticky>
</txp:if_individual_article>
<txp:mg_txpversion />
<txp:page_title separator=" } " />
<txp:if_section name="default">
[<txp:if_section name="default">: false]
<txp:if_article_list>
[<txp:if_article_list>: false]
<txp:article>
<txp:smd_tag_list wraptag="" break=", " indent="">
[SQL (0.00152683258057): show columns from smd_tags]
[SQL (0.00133895874023): SELECT id, name, txt.type, parent, title, count(item_id) AS count,(SELECT CAST((rgt - lft - 1) / 2 AS UNSIGNED)) AS children,(SELECT COUNT(*) FROM smd_tags WHERE type='article' AND name=name AND lft < txt.lft AND rgt > txt.rgt)-1 AS level FROM smd_tags AS txt, smd_tags_used AS txu WHERE txt.type='article' AND tag_id = id AND item_id='111' GROUP BY id]
[SQL (0.000257968902588): select lft as l, rgt as r from smd_tags where name='root' and type = 'article']
[SQL (0.000264883041382): select id, name, lft, rgt, parent, title from smd_tags where lft between 1 and 20 and type = 'article' and name != 'root' and id IN ('5','8') order by lft asc]
[SQL (0.000211954116821): select count(*) from smd_tags_used where type='article' AND tag_id='5']
<txp:smd_tag_name title="1" />
[SQL (0.00177407264709): show columns from smd_tags]
[SQL (0.00108480453491): select name,val,html from txp_prefs where name IN ('smd_tag_u_sec','smd_tag_u_pnam','smd_tag_u_ptyp') ORDER BY name]
[SQL (0.000298976898193): select count(*) from smd_tags_used where type='article' AND tag_id='8']
<txp:smd_tag_name title="1" />
[SQL (0.00135397911072): show columns from smd_tags]
[SQL (0.00145316123962): select name,val,html from txp_prefs where name IN ('smd_tag_u_sec','smd_tag_u_pnam','smd_tag_u_ptyp') ORDER BY name]
</txp:smd_tag_list>
</txp:article>
<txp:article>
<txp:rss_auto_excerpt striptags="1" sentences="1" showlinkwithexcerpt="0" />
</txp:article>
</txp:if_article_list>
</txp:if_section>
<txp:variable name="site_search-url" />
<txp:variable name="site_feedback-email" />
<txp:variable name="site_map-url" />
<txp:site_url />
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:if_variable name="has_prev" value="">
[<txp:if_variable name="has_prev" value="">: false]
<txp:link_to_prev />
</txp:if_variable>
<txp:if_variable name="has_next" value="">
[<txp:if_variable name="has_next" value="">: true]
</txp:if_variable>
</txp:if_individual_article>
<txp:rsd />
<txp:site_url />
<txp:site_url />
<txp:if_section name="experiments">
[<txp:if_section name="experiments">: false]
<txp:site_url />
<txp:site_url />
<txp:site_url />
<txp:site_url />
<txp:site_url />
</txp:if_section>
<txp:hide>
</txp:hide>
<txp:site_url />
<txp:site_url />
<txp:if_section name="experiments">
[<txp:if_section name="experiments">: false]
</txp:if_section>
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: true]
</txp:if_comments_allowed>
</txp:if_individual_article>
<txp:if_status status="200">
[<txp:if_status status="200">: true]
<txp:section />
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:article_url_title />
</txp:if_individual_article>
</txp:if_status>
<txp:if_section name="default">
[<txp:if_section name="default">: false]
</txp:if_section>
<txp:output_form form="_nav" />
[SQL (0.000249147415161): select Form from txp_form where name='_nav']
[Form: _nav]
<txp:site_url />
<txp:page_title separator=" { " />
<txp:if_status status="404">
[<txp:if_status status="404">: false]
<txp:if_section name="default">
[<txp:if_section name="default">: false]
<txp:if_article_list>
[<txp:if_article_list>: false]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:upm_textile>
<txp:rss_auto_excerpt length="140" excerptwraptag="p" excerpt="subtitle" showlinkwithexcerpt="0" />
</txp:upm_textile>
</txp:if_individual_article>
</txp:if_article_list>
</txp:if_section>
</txp:if_status>
<txp:if_search>
[<txp:if_search>: false]
</txp:if_search>
<txp:site_url />
<txp:if_status status="404">
[<txp:if_status status="404">: false]
<txp:if_section name="wrote">
[<txp:if_section name="wrote">: true]
<txp:cbs_navigation_menu
sections="default,is,wrote,go"
titles="Home,About,Journal,Get in Touch"
accesskeys="1,3,,5"
break="li"
activeclass="active"
activenolink="true"
wraptag="ul"
/>
</txp:if_section>
</txp:if_status>
<txp:if_section name="default">
[<txp:if_section name="default">: false]
<txp:if_article_list>
[<txp:if_article_list>: false]
<txp:article />
[SQL (0.000355958938599): select Form from txp_form where name='default']
[Form: default]
<txp:breadcrumb class="breadcrumb" />
[SQL (0.000293970108032): select lft as l, rgt as r from txp_category where name='' and type = 'article']
<txp:if_article_section name="wrote, made">
[<txp:if_article_section name="wrote, made">: true]
<txp:if_article_list>
[<txp:if_article_list>: false]
</txp:if_article_list>
</txp:if_article_section>
<txp:if_article_section name="wrote, made">
[<txp:if_article_section name="wrote, made">: true]
</txp:if_article_section>
<txp:title />
<txp:if_article_section name="wrote, made">
[<txp:if_article_section name="wrote, made">: true]
<txp:if_article_list>
[<txp:if_article_list>: false]
</txp:if_article_list>
</txp:if_article_section>
<txp:if_variable name="has_excerpt" value="">
[<txp:if_variable name="has_excerpt" value="">: true]
</txp:if_variable>
<txp:if_custom_field name="letter_no">
[<txp:if_custom_field name="letter_no">: false]
</txp:if_custom_field>
<txp:if_custom_field name="gallery-name">
[<txp:if_custom_field name="gallery-name">: false]
</txp:if_custom_field>
<txp:body />
<txp:if_article_section name="wrote, made">
[<txp:if_article_section name="wrote, made">: true]
<txp:if_article_list>
[<txp:if_article_list>: false]
<txp:hide>
</txp:hide>
<txp:output_form form="_article-meta" />
[SQL (0.000237941741943): select Form from txp_form where name='_article-meta']
[Form: _article-meta]
<txp:article_image />
<txp:if_custom_field name="letter_no">
[<txp:if_custom_field name="letter_no">: false]
</txp:if_custom_field>
<txp:if_variable name="has_prev" value="">
[<txp:if_variable name="has_prev" value="">: false]
<txp:link_to_prev>
<txp:prev_title />
</txp:link_to_prev>
</txp:if_variable>
<txp:if_variable name="has_next" value="">
[<txp:if_variable name="has_next" value="">: true]
</txp:if_variable>
<txp:if_article_section name="wrote">
[<txp:if_article_section name="wrote">: true]
<txp:author />
[SQL (0.000170946121216): select RealName from txp_users where `name` = 'john' limit 1]
<txp:posted format="%Y-%m-%d" />
<txp:posted format="%A, %d %b %Y" />
</txp:if_article_section>
<txp:if_article_section name="made">
[<txp:if_article_section name="made">: false]
</txp:if_article_section>
<txp:hide>
</txp:hide>
<txp:if_custom_field name="projects_client">
[<txp:if_custom_field name="projects_client">: false]
</txp:if_custom_field>
<txp:if_custom_field name="projects_url">
[<txp:if_custom_field name="projects_url">: false]
</txp:if_custom_field>
<txp:smd_if_tag name="">
[SQL (0.00155687332153): show columns from smd_tags]
[<txp:smd_if_tag name="">: false]
<txp:smd_tag_list class="">
[SQL (0.0016610622406): show columns from smd_tags]
[SQL (0.00109601020813): SELECT id, name, txt.type, parent, title, count(item_id) AS count,(SELECT CAST((rgt - lft - 1) / 2 AS UNSIGNED)) AS children,(SELECT COUNT(*) FROM smd_tags WHERE type='article' AND name=name AND lft < txt.lft AND rgt > txt.rgt)-1 AS level FROM smd_tags AS txt, smd_tags_used AS txu WHERE txt.type='article' AND tag_id = id AND item_id='111' GROUP BY id]
[SQL (0.00031304359436): select lft as l, rgt as r from smd_tags where name='root' and type = 'article']
[SQL (0.000313997268677): select id, name, lft, rgt, parent, title from smd_tags where lft between 1 and 20 and type = 'article' and name != 'root' and id IN ('5','8') order by lft asc]
[SQL (0.000221014022827): select count(*) from smd_tags_used where type='article' AND tag_id='5']
<txp:hide>
</txp:hide>
<txp:smd_tag_name title="1" />
[SQL (0.00135111808777): show columns from smd_tags]
[SQL (0.000986099243164): select name,val,html from txp_prefs where name IN ('smd_tag_u_sec','smd_tag_u_pnam','smd_tag_u_ptyp') ORDER BY name]
[SQL (0.00023889541626): select count(*) from smd_tags_used where type='article' AND tag_id='8']
<txp:hide>
</txp:hide>
<txp:smd_tag_name title="1" />
[SQL (0.00139188766479): show columns from smd_tags]
[SQL (0.00132012367249): select name,val,html from txp_prefs where name IN ('smd_tag_u_sec','smd_tag_u_pnam','smd_tag_u_ptyp') ORDER BY name]
</txp:smd_tag_list>
</txp:smd_if_tag>
<txp:if_article_section name="wrote">
[<txp:if_article_section name="wrote">: true]
</txp:if_article_section>
</txp:if_article_list>
</txp:if_article_section>
<txp:rvm_if_privileged>
[SQL (0.000366926193237): select nonce, name, RealName, email, privs from txp_users where name = 'john']
[<txp:rvm_if_privileged>: true]
<txp:article_id />
</txp:rvm_if_privileged>
<txp:if_section name="wrote">
[<txp:if_section name="wrote">: true]
<txp:output_form form="comments_display" />
[SQL (0.000190019607544): select Form from txp_form where name='comments_display']
[Form: comments_display]
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: true]
<txp:comments_invite textonly="1" showalways="1" showcount="0" />
</txp:if_comments_allowed>
<txp:if_comments>
[<txp:if_comments>: true]
<txp:variable name="comments_count" value="<txp:comments_count />" />
<txp:comments_count />
<txp:if_variable name="comments_count" value="1">
[<txp:if_variable name="comments_count" value="1">: false]
</txp:if_variable>
<txp:comments />
[SQL (0.00060510635376): select *, unix_timestamp(posted) as time from txp_discuss where parentid=111 and visible=1 order by posted ASC ]
[SQL (0.000195980072021): select Form from txp_form where name='comments']
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
[SQL (0.000190019607544): SELECT name,RealName,email FROM txp_users WHERE name='john' LIMIT 1]
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
[Form: comments]
<txp:comment_id />
<txp:sed_get_comment_class/>
<txp:comment_time />
<txp:comment_name />
<txp:comment_permlink>
<txp:glx_gravatar default='<txp:site_url />images/acorn-child.png' />
[attribute 'default']
<txp:site_url />
[/attribute]
</txp:comment_permlink>
<txp:comment_message />
</txp:if_comments>
<txp:if_comments_preview>
[<txp:if_comments_preview>: false]
</txp:if_comments_preview>
<txp:if_comments_allowed>
[<txp:if_comments_allowed>: true]
<txp:comments_form />
[SQL (0.000442028045654): select ip from txp_discuss_ipban where `ip` = '::1' limit 1]
[SQL (0.000278949737549): select Form from txp_form where `name` = 'comment_form' limit 1]
<txp:comments_error wraptag="ol" break="li" />
<txp:comments_invite textonly="1" showalways="1" showcount="0" />
<txp:if_cookie>
</txp:if_cookie>
<txp:if_cookie>
</txp:if_cookie>
<txp:if_cookie>
</txp:if_cookie>
<txp:comments_help />
[SQL (0.000221014022827): select value from rah_comment_spam where `name` = 'field' limit 1]
</txp:if_comments_allowed>
</txp:if_section>
</txp:if_article_list>
<txp:smd_if_tag_list>
[<txp:smd_if_tag_list>: false]
</txp:smd_if_tag_list>
</txp:if_section>
<txp:rah_output_section_form prefix="_aside-" default="_aside" />
[SQL (0.000186920166016): select Form from txp_form where `name` = '_aside-wrote' limit 1]
<txp:article_custom form="_list" limit="5" section='<txp:section />' sort="Posted desc" />
[attribute 'section']
<txp:section />
[/attribute]
[SQL (0.00084114074707): 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 ('wrote') order by Posted desc limit 0, 5]
[article 111]
[SQL (0.000184059143066): select Form from txp_form where name='_list']
[Form: _list]
<txp:if_first_article>
[<txp:if_first_article>: true]
</txp:if_first_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
</txp:rvm_if_this_article>
<txp:article_image thumbnail="1" />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
</txp:rvm_if_this_article>
<txp:title />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
</txp:rvm_if_this_article>
<txp:if_last_article>
[<txp:if_last_article>: false]
</txp:if_last_article>
[article 110]
[Form: _list]
<txp:if_first_article>
[<txp:if_first_article>: false]
</txp:if_first_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:article_image thumbnail="1" />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:title />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:if_last_article>
[<txp:if_last_article>: false]
</txp:if_last_article>
[article 108]
[Form: _list]
<txp:if_first_article>
[<txp:if_first_article>: false]
</txp:if_first_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:article_image thumbnail="1" />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:title />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:if_last_article>
[<txp:if_last_article>: false]
</txp:if_last_article>
[article 19]
[Form: _list]
<txp:if_first_article>
[<txp:if_first_article>: false]
</txp:if_first_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:article_image thumbnail="1" />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
<txp:if_variable name="has_keywords" value="">
[<txp:if_variable name="has_keywords" value="">: true]
</txp:if_variable>
<txp:rss_auto_excerpt striptags="1" showlinkwithexcerpt="0" />
</txp:rvm_if_this_article>
<txp:title />
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
</txp:rvm_if_this_article>
<txp:if_last_article>
[<txp:if_last_article>: true]
</txp:if_last_article>
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:smd_related_tags type="article" label="Possibly related" labeltag="h3" wraptag="ul" break="li" />
[SQL (0.001629114151): show columns from smd_tags]
[SQL (0.00142288208008): SELECT id, name, txt.type, parent, title, count(item_id) AS count,(SELECT CAST((rgt - lft - 1) / 2 AS UNSIGNED)) AS children,(SELECT COUNT(*) FROM smd_tags WHERE type='article' AND name=name AND lft < txt.lft AND rgt > txt.rgt)-1 AS level FROM smd_tags AS txt, smd_tags_used AS txu WHERE txt.type='article' AND tag_id = id AND item_id='111' GROUP BY id]
[SQL (0.00101494789124): SELECT *,unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod FROM textpattern AS txp
LEFT JOIN smd_tags_used AS tu ON txp.id = tu.item_id
LEFT JOIN smd_tags AS smt ON tu.tag_id = smt.id
WHERE tu.type='article' AND txp.id!="111" AND txp.Section IN ('wrote') AND smt.name IN ('blogging','design') ORDER BY Posted desc LIMIT 0,99999]
[article 112]
[article 110]
[article 108]
[article 19]
<txp:article_custom limit="10" section='<txp:section />' sort="Posted desc" offset="5">
[attribute 'section']
<txp:section />
[/attribute]
[SQL (0.000603914260864): 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 ('wrote') order by Posted desc limit 5, 10]
</txp:article_custom>
</txp:if_individual_article>
<txp:output_form form="_site-info" />
[SQL (0.000231027603149): select Form from txp_form where name='_site-info']
[Form: _site-info]
<txp:cbs_navigation_menu
sections="site-map,go,help"
titles="Site Map,Contact,Help!"
accesskeys="s,9,0"
break="li"
activeclass="active"
wraptag="ul"
/>
<txp:hide>
</txp:hide>
<txp:php>
</txp:php>
<txp:image id="13" />
[SQL (0.000468969345093): select * from txp_image where id = 13 limit 1]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:title />
<txp:if_comments>
[<txp:if_comments>: false]
</txp:if_comments>
</txp:if_individual_article>
[ ~~~ secondpass ~~~ ]
-->
Offline
#4 2009-04-30 15:55:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Very strange behavior inside if_individual_article
What happens if you change your code to this:
<txp:if_individual_article>
<txp:article>
<txp:title />
<txp:if_comments><script type="text/javascript">
$my-comments-display-script;
</script></txp:if_comments>
</txp:article>
</txp:if_individual_article>
Offline
Re: Very strange behavior inside if_individual_article
I’ll tell you what happens! Problem solved— it outputs info related to the current article.
Thanks!
Still not sure what was amiss though.
Offline
#6 2009-04-30 17:48:35
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Very strange behavior inside if_individual_article
johnstephens wrote:
Still not sure what was amiss though.
I never use article related tags (representing fields in the textpattern table) other than in an article form or inside a txp:article container tag. I’m not sure if it just isn’t possible to do it your way, or if something else caused this behaviour. Anyway, glad it works now.
Last edited by els (2009-04-30 17:49:35)
Offline
Re: Very strange behavior inside if_individual_article
Els wrote:
I never use article related tags (representing fields in the textpattern table) other than in an article form or inside a txp:article container tag.
Sounds like good advice in the category of “Textpattern Best Practices”.
Offline