2

I'm very new to Drupal. I've tried to create a custom theme and edit the way comments are displayed within my nodes. All good so far apart from when my comments are submitted without a textarea filled in then drupal fires its validation function and the comments form gets reloaded/rebuilt. Unfortunately it gets reloaded outside of its container DIV container ( below ). Is there a way to get the function to return the form after it is rebuilt to the same DIV that it started out in?

Code below. Thank you.

Comment wrapper tpl:

<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>

  <?php if ($content['comment_form']): ?>
    <h5>Rate this product: </h5>
    <span><?php print $node->rate_rate_this_product_v2['#markup']; ?></span>
    <?php print render($content['comment_form']); ?>
    <h5>Read reviews for this product:</h5>
    <?php print render($content['comments']); ?>
  <?php endif; ?>
</div>

Comment tpl:

<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>


  <?php if ($new): ?>
    <span class="new"><?php print $new ?></span>
  <?php endif; ?>


  <?php print render($title_suffix); ?>



  <div class="content"<?php print $content_attributes; ?>>
    <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['links']);
      print render($content);
    ?>

  </div>

</div>

Node tpl:

<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
  <div class="content"<?php print $content_attributes; ?>>
    <?php
// We hide the comments and links now so that we can render them later.
    hide($content['comments']);

    hide($content['links']);    
    ?>


<!--/Begin Content and Side Bar -->
  <div class="container">
      <div class="row">
        <div class="col-md-6"> 
          <?php print render($content['field_product_tags']);?>
          <?php print render($content['field_image']);?>
          <div class="col-md-12">
            <div class="col-xs-6"><a href="#"><p class="ghost-btn">Share Me</p></a></div>
            <div class="col-xs-6"><a href="#"><p class="ghost-btn">Share Me</p></a></div>
          </div>

         </div>
        <div class="col-md-6">
          <div class="col-md-12">
            <?php if ($title): ?>
             <span><?php print $node->rate_rate_this_product_v2['#markup']; ?></span>
            <h2 class="title" id="page-title"> <?php print $title; ?></h2>
            <?php endif; ?>
            <h3><?php print $content['field_body_2'][0]['#markup'];;?></h3>
          </div> 
          <div class="col-md-6 ">
            <div class="col-md-12 buy-me-product-block">
              <div class="col-md-12">
                <h4>Buy Me!</h4>
                <p><?php print $content['field_price'][0]['#markup'];?></p>
              </div>
              <div class="col-md-6">
                <img src="../collections/sites/all/themes/mytheme/assets/css/images/superdrug-logo.png">
              </div>
              <div class="col-md-6">
                <img src="../collections/sites/all/themes/mytheme/assets/css/images/boots-logo.png">
              </div>
            </div>
          </div>
          <div class="col-md-12">
             <?php print render($content['body']);?>
             <div class="col-md-12 panel">

                <?php print render($content['comments']); ?>

            </div>
          </div>
         </div>
      </div>
    </div>
     <div class="block-wrapper">
        <div class="product-video-block">
          <div>
              <?php print render($content['field_video']);?>
          </div>
        </div>


        <div class="try-me-product-block">
           <div class="try-me-divider-block">
              <h3>Try Me</h3>
           </div>
        </div>
     </div>
    </div>
<!--/End Content -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.