We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension: Comment Form Tag

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
about 16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This extension makes it possible to add or change CSS attributes of the comment form HTML element.

The problem this extension solves is this: exp:comment:form tag is parsed after all other EE tags which start with “exp”. The result of this is that it is impossible to add or change any of CSS attributes of the HTML form element this tag outputs by wrapping exp:comment:form with some other tag, such as exp://replace or exp://replace_plus. That is, this will not work:

{exp:replace find="comment_form" replace="my_comment_form"}
{exp:comment:form}
{/exp:comment:form}
{/exp:replace}

Using Comment Form Tag extension you can add or change any of CSS attributes of the HTML form element exp:comment:entries outputs by adding inside this tag one or more “comment_form_tag” variables. “comment_form_tag” variable supports following parameters:

1) parameter - required. Allows to specify name of CSS atribute of HTML form element.

2) value - required. Allows to specify value of CSS atribute of HTML form element.

EXAMPLE The code

{exp:comment:form entry_id="10" preview="site/comment_preview"}
{comment_form_tag parameter="id" value="comment_form_general"}
{comment_form_tag parameter="class" value="my_form"}
{/exp:comment:form}

will output form tag having following CSS attributes:

<form id="comment_form_general" class="my_form">
       
Joobs's avatar
Joobs
362 posts
about 16 years ago
Joobs's avatar Joobs

Nice

How easy would this be to convert for the other forms that don’t allow for class names, (can’t remember which but at a guess based off the latest 2.0 update: tell-a-friend, simple and advanced search, stand alone entry form, comment, mailing list forms)?

       
Laisvunas's avatar
Laisvunas
879 posts
about 16 years ago
Laisvunas's avatar Laisvunas

Hi,

This is EE 1.x extension. It uses comment_form_end extension hook.

These are analogous hooks:

edit_wiki_article_form_end forum_submission_form_end publish_form_end weblog_standalone_form_end

It is possible to attach extension’s method to any or to some of these hooks. It seems to me that there is sense to attach extension’s method to weblog_standalone_form_end hook; I don’t find any reasons to attach it to other aforementioned hooks.

How do you think?

       
Jim Pannell's avatar
Jim Pannell
187 posts
15 years ago
Jim Pannell's avatar Jim Pannell

What a great little extension Laisvunas - just saved me some time. Thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.