Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
txp:if_keywords bug: Article tags cannot be used outside an article
I think I’ve identified a bug in the if_keywords
tag— it destroys article context.
When I use this in an article-type form called by an article tag, I get a Textpattern warning when if_keywords
evaluates true:
<meta name="Keywords" content="<txp:if_keywords><txp:keywords /><txp:else />my, default, keywords</txp:if_keywords>" />
But using txp:if_variable
doesn’t trigger the warning:
<txp:variable name="has-keywords" value='<txp:keywords />' />
<meta name="Keywords" content="<txp:if_variable name="has-keywords" value="">my, default, keywords<txp:else/><txp:keywords /></txp:if_variable>" />
Is this an obvious user-error, or can others reproduce this?
Thanks for making Textpattern so awesome!
Offline
#2 2009-05-20 03:52:36
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: txp:if_keywords bug: Article tags cannot be used outside an article
That is a bit weird, the tag set looks to me to be set properly and I am getting the following when I use it in an article form:
Tag error: <txp:keywords /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2151
textpattern/lib/txplib_misc.php:2151 trigger_error()
textpattern/publish/taghandlers.php:2301 assert_article()
textpattern/publish.php:1090 keywords()
textpattern/publish.php:1012 processtags()
textpattern/publish.php:499 parse()
index.php:45 textpattern()
//------------------------------------------------
Textpattern version: 4.0.8 (r3189)
Last Update: 2009-05-12 14:14:37/2009-02-11 21:30:33
Document root: /Library/Apache2/htdocs
$path_to_site: /Library/Apache2/htdocs/adev
Textpattern path: /Library/Apache2/htdocs/adev/textpattern
Permanent link mode: section_id_title
Temporary directory path: /private/var/tmp
Site URL: localhost/adev
PHP version: 4.3.2
GD Image Library: 2.0 or higher; supported formats: JPG, PNG.
Server Local Time: 2009-05-19 21:48:30
MySQL: 4.0.15
Locale: en_GB.UTF-8
Server: Apache/2.0.47 (Unix) DAV/2 PHP/4.3.2
Apache version: Apache/2.0.47 (Unix) DAV/2 PHP/4.3.2
PHP Server API: apache2handler
RFC 2616 headers:
Server OS: Darwin 8.11.0
Active plugins: ras_page_of-4.0.6.1, ras_if_article_keywords-4.0.6.1, ras_if_article_image-4.0.7m, smd_gallery-0.44, mod_authors_list-4.0.7.devm, smd_calendar-0.4m, ras_rollover_text-4.0.6m, ras_if_download_id-4.0.7.devm, upm_quick_write-dev-0.2, ras_if_dates-4.0.6.1, ras_plugin_credits-4.0.6.2, upm_image-0.6.1, stm_javascript-0.3, soo_txp_obj-1.0.mod_am, ied_plugin_composer-0.82, wet_haystack-0.4, jmd_admin_js-0.1, wet_native-0.2
theme_name: classic 4.0.8
Pre-flight check:
------------------------
/Library/Apache2/htdocs/adev/textpattern/setup/ still exists
------------------------
.htaccess file contents:
------------------------
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0
------------------------
Offline
Re: txp:if_keywords bug: Article tags cannot be used outside an article
johnstephens wrote:
I think I’ve identified a bug in the
if_keywords
tag— it destroys article context.
We’d need a tag trace, please.
Offline
Re: txp:if_keywords bug: Article tags cannot be used outside an article
Here’s the tag trace I posted in the other thread, which includes the specific details of how I found this behavior.
[Form: _meta-keywords]
<txp:if_keywords>
[<txp:if_keywords>: true]
</txp:if_keywords>
[ ~~~ secondpass ~~~ ]
<txp:keywords />
Tag error: <txp:keywords /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2075
-->
It didn’t seem very informative to me.
Offline
Re: txp:if_keywords bug: Article tags cannot be used outside an article
wet wrote:
We’d need a tag trace, please.
There error is real. It is caused by one missing parse()
. Fix to around line 2319 @ taghandlers.php (current rev):
function if_keywords($atts, $thing = NULL)
{
global $thisarticle;
assert_article();
extract(lAtts(array(
'keywords' => ''
), $atts));
$condition = empty($keywords) ?
$thisarticle['keywords'] :
array_intersect(do_list($keywords), do_list($thisarticle['keywords']));
return parse(EvalElse($thing, !empty($condition)));
}
Hope it helps.
Last edited by Gocom (2009-06-08 22:14:25)
Offline
Re: txp:if_keywords bug: Article tags cannot be used outside an article
Thanks. Fixed in r3213.
Offline