Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-09-01 20:26:37

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 66
Website Twitter

form displayed twice on page (and shouldn't be)

Hey guys,

A form is appearing on the page twice. (Tag trace pasted at bottom of this post.)

I have this page which is an article list:
  • http://thinkingandmaking.com/test/

If you scroll up and down, you’ll notice the form that outputs the page appears twice.

The page includes a different form based on whether or not it’s an article or a list:

<txp:if_individual_article>
    <txp:article form="ux-lab-article" />
</txp:if_individual_article>

<txp:if_article_list>
    <txp:article form="ux-lab-article-list" />
</txp:if_article_list>

In the form, ux-lab-article-list, I have removed all Textpattern tags. It’s only static HTML.

Oddly, the article page displays just fine:
  • http://thinkingandmaking.com/test/132/test-article

TXP tag trace:

[SQL (0.00010180473327637): select name, data from txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (6.6041946411133E-5): select name, code, version from txp_plugin where status = 1 AND type IN (0,1,5) order by load_order]
[SQL (5.0067901611328E-5): select name from txp_section where `name` = 'test' limit 1]
[SQL (3.8862228393555E-5): select page, css from txp_section where name = 'test' limit 1]
[SQL (3.7908554077148E-5): select host from txp_log where ip='76.31.52.14' limit 1]
[SQL (3.814697265625E-5): select user_html from txp_page where name='ux-lab-page']

[Page: ux-lab-page]

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

<txp:if_article_list>
	[<txp:if_article_list>: true]
	<txp:article form="ux-lab-article-list" />
		[filterAtts accepted]
		[SQL (0.00035500526428223): select count(*) 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 ('test')]
		[SQL (0.00033092498779297): 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 ('test') order by Posted desc limit 0, 10]
		[Article 137]
		[SQL (4.1961669921875E-5): select Form from txp_form where name='ux-lab-article-list']
		[Form: ux-lab-article-list]
		[Article 132]
		[Form: ux-lab-article-list]
</txp:if_article_list>
[ ~~~ secondpass ~~~ ]

(added bc..’s for better readability. -Els)

Last edited by els (2013-09-01 21:55:36)

Offline

#2 2013-09-01 21:41:40

etc
Developer
Registered: 2010-11-11
Posts: 5,396
Website GitHub

Re: form displayed twice on page (and shouldn't be)

It looks normal that since you have 2 articles (137 and 132), the form is output twice?

Offline

#3 2013-09-01 21:53:40

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 66
Website Twitter

Re: form displayed twice on page (and shouldn't be)

So, how do I display an entirely different page for the list than I do for the article?

I changed it form an article tag to output form and it looks like it is only including the form once now. I’ll put all the textpattern tags back in and see if it’s sorted.

Last edited by agovella (2013-09-01 22:00:19)

Offline

#4 2013-09-01 22:03:52

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: form displayed twice on page (and shouldn't be)

Add some textpattern tags to your form ux-lab-article-list, and move the static html out of it. The form could be something like this:

<h2><txp:permlink><txp:title /></txp:permlink></h2>
<txp:excerpt />

And on the page it would be:

<txp:if_article_list>
    <txp:article form="ux-lab-article-list" />
    // here your html
</txp:if_article_list>

Offline

#5 2013-09-01 22:04:04

etc
Developer
Registered: 2010-11-11
Posts: 5,396
Website GitHub

Re: form displayed twice on page (and shouldn't be)

Changing the form is a possible approach, just remember that every article will call this form, even if it does not contain txp tags. If you just want a static content, this will do:

<txp:if_article_list>
    static content, but what's the point?
</txp:if_article_list>

Offline

#6 2013-09-01 22:06:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: form displayed twice on page (and shouldn't be)

agovella wrote:

I changed it form an article tag to output form and it looks like it is only including the form once now. I’ll put all the textpattern tags back in and see if it’s sorted.

A form that is called by an article or article_custom tag, is repeated for every article, a form called by output_form only once.

Edit: Oleg was faster :)

Last edited by els (2013-09-01 22:07:58)

Offline

Board footer

Powered by FluxBB