Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-10-26 22:13:18

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Remove the div 'comments-wrapper'

Not really a feature I know, but…

Is there a good reason why a div with an id of ‘comments-wrapper’ is automatically appended into the comment form code? I see no reason for it to be there. Example…

<form id="txpCommentInputForm" method="post" action="/section/article#cpreview">
<div class="comments-wrapper">

It’s part of comment.php, starts at line 143…

# prevent XHTML Strict validation gotchas
n.'<div class="comments-wrapper">'.n.n;

My new site is HTML5, so XHTML strict validation has no relevance. What the heck does it do anyway, seems a bit hacky to me?

Cheers,
Phil

Offline

#2 2010-10-26 22:24:05

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Remove the div 'comments-wrapper'

OK, I think I’ve found out why it’s there (but it should still be removed altogether IMHO as it’s basically a dirty bit of code!)…

You put the div there just in case users did not add their own wraptags to form input, labels etc, so it stills validates OK. It’s what’s being discussed here.

Last edited by philwareham (2010-10-26 22:26:28)

Offline

#3 2010-10-27 00:04:03

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,081
Website

Re: Remove the div 'comments-wrapper'

There are some <input type="hidden"> elements coming after the submit button (automatically appended). Those need to wrapped in a block-level element for XHTML validation. You can’t control those when you build your comment form.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2010-10-27 08:31:10

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Remove the div 'comments-wrapper'

OK thanks, that’s not required anymore for HTML5 validation – inputs can sit just fine within a form without any wrapping block tag (and in the case of hidden inputs that makes sense, why do we need a wrap tag around something that won’t be visible anyway) so I’m going to comment out those lines of code in my comment.php file.

Cheers.

Last edited by philwareham (2010-10-27 08:35:15)

Offline

#5 2010-10-27 08:46:41

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,081
Website

Re: Remove the div 'comments-wrapper'

philwareham wrote:

… so I’m going to comment out those lines of code in my comment.php file.

Yeah, that’s what I’ve done quite a while ago.

PS – don’t forget the closing div ;-)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2010-10-27 09:00:41

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Remove the div 'comments-wrapper'

Yep, all done thanks Philippe.

I’ve noticed from other forum posts that you have done some work on making your textpattern install more HTML5, do you use jmd_html to strip out self closing tags (such as input, br, img etc)?

Offline

#7 2010-10-27 09:12:27

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,081
Website

Re: Remove the div 'comments-wrapper'

Yes.

And of course, I build my templates without any ' />. I think I hacked something or other to minimise the generation of those – it is mostly img and form controls. I’d need to check my local patches. classTextile.php probably (not that I use many <br> in writing), maybe somewhere else.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2010-10-27 09:36:09

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Remove the div 'comments-wrapper'

The classTextile.php was pretty straightforward to edit, just a search for img and remove any / from />, I don’t use textile to generate any <br /> or <col /> tags in articles so left them as is (I’m not brave enough to do too much customising myself).

Offline

#9 2010-10-27 12:37:21

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,081
Website

Re: Remove the div 'comments-wrapper'

Upon reviewing my patches, it seems I only modified classTextile.php for img, not br (given that I don’t use that). As for tables, I’m faster writing a table in raw html than with Textile.

The other mod I did is in txplib_forms.php: removing the / on line 157 ($o .= “>”;). With the jmd_html plugin it is not strictly necessary, it improves overall performance a wee little bit though; the plugin, php and the server have less work to do.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB