kaffa / textpattern

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

if_section strangeness #352

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Code such as <txp:if_section name="register">we are in register<txp:else 
/>we are in contact</txp:if_section>

What is the expected output? What do you see instead?
As the above code states, one should see some output regardless of whether or 
not an article exists. However, in my testing, an output is only displayed if 
an article exists in the section called, i.e "register".

What version of the product are you using? On what operating system?
TXP 4.5.4

Please provide any additional information below.

Original issue reported on code.google.com by jonathan...@gmail.com on 1 Jan 2013 at 10:36

GoogleCodeExporter commented 8 years ago
Works fine for me here.

i) Installed clean 4.5.4, turn on debug
ii) Added <txp:if_section> code to <head> - http://pastebin.com/N7wCFC2z (line 
5)
iii) Created 'register' section, do not create a new article, view in browser - 
http://pastebin.com/ctdR50xg (line 2, tag trace line 175)

Apologies for no attachments, on old iOS.

Original comment by gaek...@gmail.com on 1 Jan 2013 at 1:49

GoogleCodeExporter commented 8 years ago
More strangeness on the same dev site. Using:

<txp:if_article_list>
            <txp:article>
            <div class="row">
        <txp:else />
            <txp:article limit="1">
        </txp:if_article_list>

and later in the same page: 

<txp:if_article_list>
        </div><!-- end content row -->  
            </txp:article>
        <txp:else />
            </txp:article>
        </txp:if_article_list>

Returns in a tag trace (on an individual page, with no output on the page):

<txp:if_article_list>
    [<txp:if_article_list>: false]
</txp:if_article_list>
Tag error:   -> Textpattern Notice: Page template news does not contain a 
txp:article tag while parsing form “None” on page “news”

In the list page, the error is:

<txp:else />
            Tag error:  <txp:else /> -> Textpattern Warning: tag does not exist while parsing form “None” on page “news”

Which is repeated 4 times. No output.

Seems to me that <txp:else /> is the problem.

Original comment by jonathan...@gmail.com on 7 Jan 2013 at 2:21

GoogleCodeExporter commented 8 years ago
And for extra fun, using the following instead:

<txp:if_article_list>
            <txp:article>
            <div class="row">
        </txp:if_article_list>
        <txp:if_individual_article>
            <txp:article limit="1">
        </txp:if_individual_article>

And:

<txp:if_article_list>
            </div><!-- end content row -->  
            </txp:article>
        </txp:if_article_list>
        <txp:if_individual_article>
            </txp:article>
        </txp:if_individual_article>

Returns no output at all on either list or individual pages. No error on list 
page, only on individual page:

<txp:if_article_list>
    [<txp:if_article_list>: false]
</txp:if_article_list>

Tag error:   -> Textpattern Notice: Page template news does not contain a 
txp:article tag while parsing form “None” on page “news”

Original comment by jonathan...@gmail.com on 7 Jan 2013 at 2:28

GoogleCodeExporter commented 8 years ago
For completeness, using the tags as follows:

<txp:if_article_list>
entire code block....
</txp:if_article_list>

<txp:if_individual_article>
entire individual article code block ...
</txp:if_individual_article>

Works just fine without <txp:else />. 

Original comment by jonathan...@gmail.com on 7 Jan 2013 at 2:33

GoogleCodeExporter commented 8 years ago
Hi Jonathan,

The latter code would indeed work. Not exactly due to else, but validity of the 
markup syntax.

The code you have used can not be parsed correctly. Any block needs to be 
closed with within the same level as it was opened. This is similarly to XML or 
HTML. You can't have an opening tag wrapped inside a container tag (e.g. 
conditional tag) and closed elsewhere. The block will have to be closed inside 
the same container block.

Closing this report as an invalid. If you need any further support, feel free 
to ask on the forums for help.

Original comment by jukka.m.svahn on 15 Jan 2013 at 4:17