Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: [MOD] Hidden comment form until clicked  (Read 30448 times)

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
[MOD] Hidden comment form until clicked
« on: March 29, 2007, 05:19:32 PM »

UPDATED March 30, 2007 - added "some text instructing the user to click the comment title to leave a comment or such."
This is just an aesthetic mode.  It puts the comment form into a hidden div until clicked on, then it opens up.  This is just to save some screen space unless the viewer wants to leave a comment.

Closed div:

Opened div:


Here what to do. From to bottom:

1. Backup snews.php file

2. function l() - ADD the red - language varible UPDATE
Quote
$l['on'] = 'on'; // preposition word used in comments infoline
   $l['clickcomment'] = 'Click here to show/hide comment form';
   #paginator
3. function title() - ADD the red
Quote
if ($_SESSION[db('website').'Logged_In'] == token()) {js();}
   toggle_div();
}
4. function comment() - ADD the red UPDATE changed whereblue
Quote
if ($freeze_status != 'freezed') {
      html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '','<a title="'.l('clickcomment').'" onclick="toggle(\'sub1\')" style="cursor: pointer;">'.l('clickcomment').'</a>');
      echo '<div id="sub1" style="display: none;">';

      echo '<div class="commentsbox"><h2>'.l('addcomment').'</h2>';
      html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
      html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'url', 'url', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('textarea', 'text', 'text', '', '* '.l('comment'), '', '', '', '', '', '5', '5', '', '', '');
      echo mathCaptcha();
      echo '<p>';
      html_input('hidden', 'category', 'category', $categorySEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'id', 'id', $articleId, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'article', 'article', $articleSEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'commentspage', 'commentspage', $back_to_page, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
      html_input('submit', 'comment', 'comment', l('submit'), '', 'button', '', '', '', '', '', '', '', '', '');
      echo '</p></form></div></div></fieldset>';
}}}
5. function js() - REMOVE the following
Quote
// toggle dynamic divs
   function toggle(div) {
      if (document.getElementById(div).style.display=='') {
         document.getElementById(div).style.display = 'none';
         return
      } document.getElementById(div).style.display = '';
   }
6. ADD the red - BEFORE the very last line of snews.php
Quote
<?php }
function toggle_div() { ?>
<script type="text/javascript">
   // toggle dynamic divs
   function toggle(div) {
      if (document.getElementById(div).style.display=='') {
         document.getElementById(div).style.display = 'none';
         return
      } document.getElementById(div).style.display = '';
   }
</script>

<?php } ?>
« Last Edit: October 25, 2007, 06:22:12 PM by Keyrocks »
Logged

Fred K

  • sNews Dude
  • ULTIMATE member
  • *****
  • Karma: 134
  • Posts: 2806
[MOD] Hidden comment form until clicked
« Reply #1 on: March 29, 2007, 05:27:50 PM »

you could also make the textarea shorter. digging through the default css and finding the height set to 20em, I almost fell off my chair... :)

(I mean, as an option, a non-javascript solution.)

tobto

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 72
    • seo service
[MOD] Hidden comment form until clicked
« Reply #2 on: March 29, 2007, 05:50:28 PM »

thank you very mucho!!! :
 I waited for that nice mod
Logged

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 78
  • Posts: 522
  • Awesome day :)
[MOD] Hidden comment form until clicked
« Reply #3 on: March 29, 2007, 06:04:36 PM »

yup a good one, added  :cool:
thank you bakercad
Logged

4Sandrix

  • Hero Member
  • *****
  • Karma: -13
  • Posts: 613
    • http://fedrick.deviantart.com
[MOD] Hidden comment form until clicked
« Reply #4 on: March 29, 2007, 07:26:05 PM »

Nice one Baker   :)
Logged
I'm kind of like Han Solo always strokin' my own Wookiee
I'm the root of all that's evil yeah but you can call me Cookie

hafing

  • Full Member
  • ***
  • Karma: 1
  • Posts: 179
[MOD] Hidden comment form until clicked
« Reply #5 on: March 30, 2007, 12:28:05 AM »

hi bakercad
I really like this mod.
I've allready installed it and it works nicely.   ;)
Thank you!
 :cool:
Logged
I can be 2fast and 2curious

piXelatedEmpire

  • MIA
  • Thread Moderator
  • ULTIMATE member
  • *****
  • Karma: 37
  • Posts: 1454
  • currently MIA
[MOD] Hidden comment form until clicked
« Reply #6 on: March 30, 2007, 01:41:13 AM »

yup, great little MOD.
Maybe could add some text instructing the user to click the comment title to leave a comment or such ;)
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 476
[MOD] Hidden comment form until clicked
« Reply #7 on: March 30, 2007, 03:48:41 AM »

Nice great addition. Thanks.
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

mike1

  • Full Member
  • ***
  • Karma: 6
  • Posts: 205
[MOD] Hidden comment form until clicked
« Reply #8 on: March 30, 2007, 05:45:03 AM »

would ya focus on one mod at a time ADD man?? :P

haha, just ribbin ya.  another keeper you have here.
Logged

hafing

  • Full Member
  • ***
  • Karma: 1
  • Posts: 179
[MOD] Hidden comment form until clicked
« Reply #9 on: March 30, 2007, 10:51:09 AM »

hi bakercad
pix has a point here. it would be nice if  you
"could add some text instructing the user to click the comment title to leave a comment".
As for now visitor could overlook   the comment feature.  :)

 :cool:
Logged
I can be 2fast and 2curious

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
[MOD] Hidden comment form until clicked
« Reply #10 on: March 30, 2007, 07:46:37 PM »

updated code (& images) per the request for instructing the user to click..

@hafing - I noticed on your website (http://www.sh.is/), an image and link for Alcan.  FYI, my father retired from an Alcan plant in Oswego, NY, USA about 3 years ago.  Worked there for over 30 years.  When I was in college, I worked there during the summer.....small world
Logged

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 476
[MOD] Hidden comment form until clicked
« Reply #11 on: March 30, 2007, 08:36:38 PM »

Added it to my site, thanks works perfectly.  :D
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6290
  • Semantically Challenged
    • snews.ca
[MOD] Hidden comment form until clicked
« Reply #12 on: March 30, 2007, 09:53:44 PM »

This one's a keeper... I'm adding it to my mod-packs now. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
[MOD] Hidden comment form until clicked
« Reply #13 on: March 30, 2007, 10:18:38 PM »

glad to hear this is useful.  thanks for the kind words folks.  :)
Logged

DavidF

  • Newbie
  • *
  • Karma: 0
  • Posts: 17
    • http://www.davidfrosdick.com
[MOD] Hidden comment form until clicked
« Reply #14 on: March 31, 2007, 01:37:49 AM »

That works sweet.

Cheers bakercad!
Logged
Pages: [1] 2