Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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)
Offline
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
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
Offline
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
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
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