bgarrels / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

txp:category1 delivers different results when used in containers vs. article form #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
jstubbs reports:

I am using the latest SVN revision on a live test site, and have come
across a possible bug.

If I use this code category1 displays the correct category name:

<txp:if_section name="my-section">
<txp:article limit="1" form="my-form" >
<h2><txp:title /></h2>
<p class="post">Category: <txp:category1 link="1" title="1"
section="my-section" /></p>
<txp:body />
</txp:article>
</txp:if_section>

But, if I use this:

<txp:if_section name="my-section">
<txp:article limit="1" form="my-form" />
</txp:if_section>

With form my-form contents:

<h2><txp:title /></h2>
<p class="post">Category: <txp:category1 link="1" title="1"
section="my-section" /></p>
<txp:body />

Then the category1 is a different category. Head scratch!!

I presume that placing attributes within a container tag takes precedence
over the form=“my-form” attribute in a single tag, but the category should
still be the same..

Related discussion: http://forum.textpattern.com/viewtopic.php?id=31117

Original issue reported on code.google.com by r.wetzlmayr on 25 Jun 2009 at 10:36

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I believe txp:category throws the same error but I have not tested it to 
check...

Original comment by jonathan...@gmail.com on 25 Jun 2009 at 1:02

GoogleCodeExporter commented 9 years ago
I cannot reproduce this symptom. Need a tag trace for both variations.

Original comment by r.wetzlmayr on 26 Jun 2009 at 9:44

GoogleCodeExporter commented 9 years ago
Actually I was just trying different things when I saw the original bug error. 
If you look at my second example 
above which uses a form="my-form", changing txp:category1 to txp:category 
outputs the wrong category. But - 
I think this is more an error of logic rather than a bug.

Original comment by jonathan...@gmail.com on 26 Jun 2009 at 9:00

GoogleCodeExporter commented 9 years ago
Second example (the one with the form attribute that fails):

<!-- Runtime:    0.0786 -->
<!-- Query time: 0.008269 -->
<!-- Queries: 35 -->
<!-- Memory: 6376Kb, <txp:if_comments_preview> -->
<!-- txp tag trace: 
[SQL (0.00021600723266602): select name, data from txp_lang where lang='en-gb' 
AND ( event='public' OR 
event='common')]
[SQL (0.0015790462493896): select name, code, version from txp_plugin where 
status = 1 AND type IN (0,1) 
order by load_order]
[SQL (0.00012421607971191): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_admin_parse']
[SQL (0.00016117095947266): select name,code,version from txp_plugin where 
status = 1 AND 
name='ign_password_protect']
[SQL (0.00032281875610352): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_self_register']
[SQL (0.00019192695617676): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_form']
[SQL (0.00029897689819336): select name,code,version from txp_plugin where 
status = 1 AND 
name='glz_custom_fields']
[SQL (0.00071811676025391): 
    SELECT
      `name` AS custom_set,
      `val` AS name,
      `html` AS type
    FROM
      `txp_prefs`
    WHERE
      `event`='custom'
    ORDER BY
      `position`
  ]
[SQL (0.00012993812561035): 
    SELECT
      `name` AS custom_set,
      `val` AS name,
      `html` AS type
    FROM
      `txp_prefs`
    WHERE
      `event`='custom'
    ORDER BY
      `position`
  ]
[SQL (0.00019001960754395): select ID, Section from textpattern where ID = 810 
and Section = 'tennis-jobs' 
and Status >= 4 limit 1]
[SQL (0.00012898445129395): select page, css from txp_section where name = 
'tennis-jobs' limit 1]
[SQL (0.00011301040649414): select *, unix_timestamp(Posted) as uPosted, 
unix_timestamp(Expires) as 
uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=810 and 
Status in (4,5)]
[article 810]
[SQL (0.00061202049255371): select ID, Title, url_title, unix_timestamp(Posted) 
as uposted
            from textpattern where Posted > '2009-06-24 07:36:32' and Section = 'tennis-jobs' 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.00091910362243652): select ID, Title, url_title, unix_timestamp(Posted) 
as uposted
            from textpattern where Posted < '2009-06-24 07:36:32' and Section = 'tennis-jobs' 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.00019001960754395): select user_html from txp_page where 
name='classifieds']
[Page: classifieds]
<txp:php>
</txp:php>
<txp:output_form form="header" />
    [SQL (0.00014519691467285): select Form from txp_form where name='header']
    [Form: header]
    <txp:feed_link flavor="atom" format="link" label="Atom" />
    <txp:feed_link flavor="rss" format="link" label="RSS" />
    <txp:rvm_css format="link" n="default" />
    <txp:rvm_css format="link" n="menu" />
    <txp:if_section name="post-a-classified">
        [<txp:if_section name="post-a-classified">: false]
    </txp:if_section>
    <txp:js n="drop_down" />
    <txp:page_title />
<txp:output_form form="sitename" />
    [SQL (0.00010299682617188): select Form from txp_form where name='sitename']
    [Form: sitename]
    <txp:site_name />
    <txp:site_slogan />
<txp:output_form form="P7_dropmenu" />
    [SQL (7.7962875366211E-5): select Form from txp_form where name='P7_dropmenu']
    [Form: P7_dropmenu]
    <txp:if_section name="">
        [<txp:if_section name="">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="tennis-jobs">
        [<txp:if_section name="tennis-jobs">: true]
    </txp:if_section>
    <txp:site_url />
    <txp:category_list break="li" exclude="tennis-jobs" parent="tennis-jobs" section="tennis-jobs" 
type="article" wraptag="ul" class="" />
        [SQL (7.8201293945312E-5): select lft, rgt from txp_category where type = 'article' and name = 
'tennis-jobs']
        [SQL (6.8187713623047E-5): select name, title from txp_category where (lft between 22 and 29) and 
type = 'article' and name != 'default' and name not in('tennis-jobs')  order by 
lft ASC]
    <txp:if_section name="tennis-classifieds">
        [<txp:if_section name="tennis-classifieds">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:category_list break="li" exclude="tennis-classifieds" parent="tennis-classifieds" section="tennis-
classifieds" type="article" wraptag="ul" class="" />
        [SQL (0.00014185905456543): select lft, rgt from txp_category where type = 'article' and name = 
'tennis-classifieds']
        [SQL (6.0796737670898E-5): select name, title from txp_category where (lft between 4 and 21) and 
type = 'article' and name != 'default' and name not in('tennis-classifieds')  
order by lft ASC]
    <txp:if_section name="register">
        [<txp:if_section name="register">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="post-a-classified">
        [<txp:if_section name="post-a-classified">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="my-classifieds">
        [<txp:if_section name="my-classifieds">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:if_section name="about,faq,contact,news">
        [<txp:if_section name="about,faq,contact,news">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:if_section name="subscribers,why">
        [<txp:if_section name="subscribers,why">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
<txp:if_individual_article>
    [<txp:if_individual_article>: true]
    <txp:if_section name="tennis-jobs">
        [<txp:if_section name="tennis-jobs">: true]
        <txp:php>
            Tag error:  <txp:php> -> Notice: Undefined index:  _amember_product_ids  on line 22
            Tag error:  <txp:php> -> Warning: array_intersect() [<a href='function.array-
intersect'>function.array-intersect</a>]: Argument #1 is not an array  on line 
22
        </txp:php>
        <txp:article limit="1" form="job_single" />
            [SQL (0.00012993812561035): select Form from txp_form where name='job_single']
            [Form: job_single]
            <txp:posted format="%a" />
            <txp:posted format="%b" />
            <txp:posted format="%d" />
            <txp:posted format="%Y" />
            <txp:title />
            <txp:category1 link="1" title="1" section="tennis-classifieds" />
                [SQL (6.3896179199219E-5): select title from txp_category where name='Tennis-Jobs-
USA' and type='article']
            <txp:if_custom_field name="Country">
                [<txp:if_custom_field name="Country">: true]
                <txp:custom_field name="Country" />
            </txp:if_custom_field>
            <txp:if_custom_field name="State">
                [<txp:if_custom_field name="State">: true]
                <txp:custom_field name="State" />
            </txp:if_custom_field>
            <txp:body />
            [SQL (6.0081481933594E-5): select Form from txp_form where name='comments_display']
            [Form: comments_display]
            <txp:text item="comment" />
            <txp:comments_invite textonly="1" showalways="1" showcount="0" />
            <txp:comments />
            <txp:if_comments_allowed>
                [<txp:if_comments_allowed>: false]
            </txp:if_comments_allowed>
            <txp:if_comments_preview>
                [<txp:if_comments_preview>: false]
            </txp:if_comments_preview>
    </txp:if_section>
    <txp:if_section name="tennis-classifieds">
        [<txp:if_section name="tennis-classifieds">: false]
    </txp:if_section>
</txp:if_individual_article>
<txp:if_article_list>
    [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_section name="tennis-jobs">
    [<txp:if_section name="tennis-jobs">: true]
    <txp:output_form form="subscriber_login" />
        [SQL (6.8187713623047E-5): select Form from txp_form where name='subscriber_login']
        [Form: subscriber_login]
</txp:if_section>
<txp:output_form form="search" />
    [SQL (6.103515625E-5): select Form from txp_form where name='search']
    [Form: search]
    <txp:site_url />
<txp:output_form form="rss_feeds" />
    [SQL (6.0796737670898E-5): select Form from txp_form where name='rss_feeds']
    [Form: rss_feeds]
    <txp:section title="1" />
        [SQL (5.9127807617188E-5): select title from txp_section where name='tennis-jobs']
    <txp:feed_link flavor="rss" label="RSS" />
    <txp:feed_link flavor="atom" label="Atom" />
<txp:output_form form="google_textads" />
    [SQL (6.1988830566406E-5): select Form from txp_form where name='google_textads']
    [Form: google_textads]
    <txp:output_form form="text_link_ads" />
        [SQL (7.0095062255859E-5): select Form from txp_form where name='text_link_ads']
        [Form: text_link_ads]
        <txp:php>
        </txp:php>
    <txp:output_form form="text_link_ads_affiliate" />
        [SQL (7.9154968261719E-5): select Form from txp_form where name='text_link_ads_affiliate']
        [Form: text_link_ads_affiliate]
<txp:output_form form="footer" />
    [SQL (5.9127807617188E-5): select Form from txp_form where name='footer']
    [Form: footer]
    <txp:php>
    </txp:php>
<txp:output_form form="google_analytics" />
    [SQL (0.0001518726348877): select Form from txp_form where name='google_analytics']
    [Form: google_analytics]
[ ~~~ secondpass ~~~ ]
 -->

Original comment by jonathan...@gmail.com on 26 Jun 2009 at 9:03

GoogleCodeExporter commented 9 years ago
Example one (which works) - container tag:

<!-- Runtime:    0.0775 -->
<!-- Query time: 0.007521 -->
<!-- Queries: 34 -->
<!-- Memory: 6397Kb, <txp:if_comments_preview> -->
<!-- txp tag trace: 
[SQL (0.00017404556274414): select name, data from txp_lang where lang='en-gb' 
AND ( event='public' OR 
event='common')]
[SQL (0.0014791488647461): select name, code, version from txp_plugin where 
status = 1 AND type IN (0,1) 
order by load_order]
[SQL (0.00017809867858887): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_admin_parse']
[SQL (0.00028204917907715): select name,code,version from txp_plugin where 
status = 1 AND 
name='ign_password_protect']
[SQL (0.00033307075500488): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_self_register']
[SQL (0.00023603439331055): select name,code,version from txp_plugin where 
status = 1 AND 
name='mem_form']
[SQL (0.0003972053527832): select name,code,version from txp_plugin where 
status = 1 AND 
name='glz_custom_fields']
[SQL (0.00051689147949219): 
    SELECT
      `name` AS custom_set,
      `val` AS name,
      `html` AS type
    FROM
      `txp_prefs`
    WHERE
      `event`='custom'
    ORDER BY
      `position`
  ]
[SQL (0.00019407272338867): 
    SELECT
      `name` AS custom_set,
      `val` AS name,
      `html` AS type
    FROM
      `txp_prefs`
    WHERE
      `event`='custom'
    ORDER BY
      `position`
  ]
[SQL (0.00013899803161621): select ID, Section from textpattern where ID = 810 
and Section = 'tennis-jobs' 
and Status >= 4 limit 1]
[SQL (6.6041946411133E-5): select page, css from txp_section where name = 
'tennis-jobs' limit 1]
[SQL (0.00011491775512695): select *, unix_timestamp(Posted) as uPosted, 
unix_timestamp(Expires) as 
uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=810 and 
Status in (4,5)]
[article 810]
[SQL (0.0005650520324707): select ID, Title, url_title, unix_timestamp(Posted) 
as uposted
            from textpattern where Posted > '2009-06-24 07:36:32' and Section = 'tennis-jobs' 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.00094294548034668): select ID, Title, url_title, unix_timestamp(Posted) 
as uposted
            from textpattern where Posted < '2009-06-24 07:36:32' and Section = 'tennis-jobs' and 
Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 
00:00:00') order by Posted 
desc limit 1]
[SQL (6.7949295043945E-5): select user_html from txp_page where 
name='classifieds']
[Page: classifieds]
<txp:php>
</txp:php>
<txp:output_form form="header" />
    [SQL (6.6041946411133E-5): select Form from txp_form where name='header']
    [Form: header]
    <txp:feed_link flavor="atom" format="link" label="Atom" />
    <txp:feed_link flavor="rss" format="link" label="RSS" />
    <txp:rvm_css format="link" n="default" />
    <txp:rvm_css format="link" n="menu" />
    <txp:if_section name="post-a-classified">
        [<txp:if_section name="post-a-classified">: false]
    </txp:if_section>
    <txp:js n="drop_down" />
    <txp:page_title />
<txp:output_form form="sitename" />
    [SQL (9.5129013061523E-5): select Form from txp_form where name='sitename']
    [Form: sitename]
    <txp:site_name />
    <txp:site_slogan />
<txp:output_form form="P7_dropmenu" />
    [SQL (6.6995620727539E-5): select Form from txp_form where name='P7_dropmenu']
    [Form: P7_dropmenu]
    <txp:if_section name="">
        [<txp:if_section name="">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="tennis-jobs">
        [<txp:if_section name="tennis-jobs">: true]
    </txp:if_section>
    <txp:site_url />
    <txp:category_list break="li" exclude="tennis-jobs" parent="tennis-jobs" section="tennis-jobs" 
type="article" wraptag="ul" class="" />
        [SQL (6.103515625E-5): select lft, rgt from txp_category where type = 'article' and name = 'tennis-
jobs']
        [SQL (5.8889389038086E-5): select name, title from txp_category where (lft between 22 and 29) and 
type = 'article' and name != 'default' and name not in('tennis-jobs')  order by 
lft ASC]
    <txp:if_section name="tennis-classifieds">
        [<txp:if_section name="tennis-classifieds">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:category_list break="li" exclude="tennis-classifieds" parent="tennis-classifieds" section="tennis-
classifieds" type="article" wraptag="ul" class="" />
        [SQL (5.8889389038086E-5): select lft, rgt from txp_category where type = 'article' and name = 
'tennis-classifieds']
        [SQL (6.0081481933594E-5): select name, title from txp_category where (lft between 4 and 21) and 
type = 'article' and name != 'default' and name not in('tennis-classifieds')  
order by lft ASC]
    <txp:if_section name="register">
        [<txp:if_section name="register">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="post-a-classified">
        [<txp:if_section name="post-a-classified">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:if_section name="my-classifieds">
        [<txp:if_section name="my-classifieds">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:if_section name="about,faq,contact,news">
        [<txp:if_section name="about,faq,contact,news">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:if_section name="subscribers,why">
        [<txp:if_section name="subscribers,why">: false]
    </txp:if_section>
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
    <txp:site_url />
<txp:if_individual_article>
    [<txp:if_individual_article>: true]
    <txp:if_section name="tennis-jobs">
        [<txp:if_section name="tennis-jobs">: true]
        <txp:php>
            Tag error:  <txp:php> -> Notice: Undefined index:  _amember_product_ids  on line 22
            Tag error:  <txp:php> -> Warning: array_intersect() [<a href='function.array-
intersect'>function.array-intersect</a>]: Argument #1 is not an array  on line 
22
        </txp:php>
        <txp:article limit="1">
            <txp:posted format="%a" />
            <txp:posted format="%b" />
            <txp:posted format="%d" />
            <txp:posted format="%Y" />
            <txp:title />
            <txp:category1 link="1" title="1" section="tennis-jobs" />
                [SQL (7.5817108154297E-5): select title from txp_category where name='Tennis-Jobs-
USA' and type='article']
            <txp:if_custom_field name="Country">
                [<txp:if_custom_field name="Country">: true]
                <txp:custom_field name="Country" />
            </txp:if_custom_field>
            <txp:if_custom_field name="State">
                [<txp:if_custom_field name="State">: true]
                <txp:custom_field name="State" />
            </txp:if_custom_field>
            <txp:body />
            [SQL (6.103515625E-5): select Form from txp_form where name='comments_display']
            [Form: comments_display]
            <txp:text item="comment" />
            <txp:comments_invite textonly="1" showalways="1" showcount="0" />
            <txp:comments />
            <txp:if_comments_allowed>
                [<txp:if_comments_allowed>: false]
            </txp:if_comments_allowed>
            <txp:if_comments_preview>
                [<txp:if_comments_preview>: false]
            </txp:if_comments_preview>
        </txp:article>
    </txp:if_section>
    <txp:if_section name="tennis-classifieds">
        [<txp:if_section name="tennis-classifieds">: false]
    </txp:if_section>
</txp:if_individual_article>
<txp:if_article_list>
    [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_section name="tennis-jobs">
    [<txp:if_section name="tennis-jobs">: true]
    <txp:output_form form="subscriber_login" />
        [SQL (8.5115432739258E-5): select Form from txp_form where name='subscriber_login']
        [Form: subscriber_login]
</txp:if_section>
<txp:output_form form="search" />
    [SQL (6.1988830566406E-5): select Form from txp_form where name='search']
    [Form: search]
    <txp:site_url />
<txp:output_form form="rss_feeds" />
    [SQL (5.8174133300781E-5): select Form from txp_form where name='rss_feeds']
    [Form: rss_feeds]
    <txp:section title="1" />
        [SQL (5.6982040405273E-5): select title from txp_section where name='tennis-jobs']
    <txp:feed_link flavor="rss" label="RSS" />
    <txp:feed_link flavor="atom" label="Atom" />
<txp:output_form form="google_textads" />
    [SQL (5.9127807617188E-5): select Form from txp_form where name='google_textads']
    [Form: google_textads]
    <txp:output_form form="text_link_ads" />
        [SQL (6.7949295043945E-5): select Form from txp_form where name='text_link_ads']
        [Form: text_link_ads]
        <txp:php>
        </txp:php>
    <txp:output_form form="text_link_ads_affiliate" />
        [SQL (7.7962875366211E-5): select Form from txp_form where name='text_link_ads_affiliate']
        [Form: text_link_ads_affiliate]
<txp:output_form form="footer" />
    [SQL (5.9843063354492E-5): select Form from txp_form where name='footer']
    [Form: footer]
    <txp:php>
    </txp:php>
<txp:output_form form="google_analytics" />
    [SQL (5.9843063354492E-5): select Form from txp_form where name='google_analytics']
    [Form: google_analytics]
[ ~~~ secondpass ~~~ ]
 -->

Original comment by jonathan...@gmail.com on 26 Jun 2009 at 9:04

GoogleCodeExporter commented 9 years ago
- What was the expected output / category?
- What was the actual output / category?

Original comment by r.wetzlmayr on 14 Jul 2009 at 6:57

GoogleCodeExporter commented 9 years ago
The expected output was a category called "Tennis Jobs". What displayed instead 
was a category called "Tennis 
Classifieds".

Original comment by jonathan...@gmail.com on 14 Jul 2009 at 8:39

GoogleCodeExporter commented 9 years ago
I think we are watching slightly different "section" attributes at work here:

<txp:category1 link="1" title="1" section="tennis-classifieds" /> in form
"job_single" (http://code.google.com/p/textpattern/issues/detail?id=6#c6)

vs.

<txp:category1 link="1" title="1" section="tennis-jobs" /> in the container 
variant
(http://code.google.com/p/textpattern/issues/detail?id=6#c5).

Original comment by r.wetzlmayr on 14 Jul 2009 at 8:58

GoogleCodeExporter commented 9 years ago
Hi Robert, not sure if I have been a little unclear in my description. My first 
post above stands and I do see an 
error in the category link outputted when using the "job_single" form attribute.

What is displayed on the screen is the correct name of the category, but the 
link outputted is /tennis-
classifieds/?c=Tennis-Jobs-USA instead of /tennis-jobs/?c=Tennis-Jobs-USA.

The following is outputted when using txp:article in container variant: 
/tennis-jobs/?c=Tennis-Jobs-USA

I can give you a login if you like to check it out ;-)

Original comment by jonathan...@gmail.com on 14 Jul 2009 at 8:04

GoogleCodeExporter commented 9 years ago
This is the expected behaviour as in case #1 you use <txp:category1 ...
section="tennis-classifieds" />, while in case #2 you use <txp:category1 ...
section="tennis-jobs" />. 

NB: The section atrributes are different and thus result in differnt links.

Original comment by r.wetzlmayr on 15 Jul 2009 at 4:17

GoogleCodeExporter commented 9 years ago
Cannot reproduce on fresh install, cannot fix on affected site. Looks like a 
heisenbug.

Original comment by r.wetzlmayr on 26 Jul 2009 at 1:14