Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-01 21:37:09

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

txp:comments_invite outputs malformed HTML

Hi,
I hope I’m doing something wrong, because I dont want to be remembered as the first one in report a bug for 4.0.2.
Well, the report:

When using <code><txp:comments_invite wraptag=“li” /></code> in an article form (used to display individual articles), if <code>showalways</code> attribute is set to default (that is, 0), the HTML outputted is the following:

<code><li class=“comments_invite” /></code>

First, the above is malformed.
Second, as far as I understand, TXP shouldnt return anything in this case, because, showalways” is set to 0 and the context is an individual article page.

That’s all. I hope I went wrong somewhere.

Last edited by maniqui (2005-11-01 22:04:14)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2005-11-01 21:43:39

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: txp:comments_invite outputs malformed HTML

Bah, it’s a bug that got introduced during some minor refactoring. In taghandlers.php around line 739 you will see:

<code>
}
if ($wraptag) $invite_return = doTag($invite_return, $wraptag, $class);
return $invite_return;
</code>

It should have been (meaning, you can replace it with):
<code>
if ($wraptag) $invite_return = doTag($invite_return, $wraptag, $class);
}
return $invite_return;
</code>

(meaning just move the closing bracket below the line with the if.

Alternatively you can work around this bug by adding an if_individual_article around the comments_invite.

Offline

#3 2005-11-01 22:26:09

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: txp:comments_invite outputs malformed HTML

Thanks, Sencer!

I made the change in taghandlers.php and now it works as expected.

Oh… I have been informed that you have post a reply in other of my threads!
I’m running from thread to thread in the forum. I’m very excited with the new release. :D


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2005-11-03 11:42:30

jordi
Member
From: Barcelona
Registered: 2005-09-14
Posts: 94
Website

Re: txp:comments_invite outputs malformed HTML

May be a bug, may be a mistake on my part, but…

I see that that <code>txp:comments_invite</code> by default outputs the result inside an “a” tag. However, if there’s no text in the invitation field for this article, it fails to close the tag. I copy a chunk of HTML:

<code><h3> … <a href=“here the path” class=“comments_invite” /> [11]</h3>
<p>blah blah.</p></code>

This converts anything that follows in a link, until the next <code></a></code> tag.

I’ve made the suggested change in taghandlers.php but it does not seem to have any effect on this. If I set a textonly attribute to 1 inside the comments_invite tag, the “a” of course dissapears as the number of comments is output as plain text.

Offline

#5 2005-11-03 11:59:09

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: txp:comments_invite outputs malformed HTML

That’s an interesting case, that was not seen as a use case. If you leave the per-article invite empty, it will use the global invite from preferences. Your case only happens when both are empty – in which case I wouldn’t have assumed anybody wants the comments_invite…

What it outputs is a single, self closing <a href="..." />, which is indeed not valid (I think).

Since the Comment-Number is always outside the link, what you really want to do is simply use: <txp:comments_count />

Offline

#6 2005-11-03 12:38:41

jordi
Member
From: Barcelona
Registered: 2005-09-14
Posts: 94
Website

Re: txp:comments_invite outputs malformed HTML

Makes a lot of sense, thanks.

As for me, I’ve since filled the invitation field, so it works as expected. However, I think that it should never output an unclosed tag, whatever the case.

Offline

Board footer

Powered by FluxBB