ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Publishing a book

August 07, 2013 8:07am

Subscribe [2]
  • #1 / Aug 07, 2013 8:07am

    sore eyes

    34 posts

    I am trying to publish my book on my website. I am using ‘categories’, which correspond to the title of each chapter entry (the result is similar to Acrobat Reader, where the contents are shown in the sidebar). It works okay, however, as I wish to allow the reader to make comments on each chapter, I run into the problem that the comments form will not show.

    The book.channel preferences is set to allow comments.

    When I click on the sidebar chapter ‘becoming-a-success’ , the URL shown is

    http://localhost/HTGMC/index.php/book/section/category/becoming-a-success

    where ‘book’ is the channel and ‘section’ is the template.

    The code in the section template is given below…

    <div id="main">
        
        
            {exp:channel:category_heading channel="book"}
                <h2>{category_name}</h2>
    <p>        {/exp:channel:category_heading}<br />
            <br />
            {exp:channel:entries channel="book" limit=1}<br />
                {body}<br />
                <a href="#">{comment_total} comments</a></p>
    
    <p>        {/exp:channel:entries}<br />
            <br />
              <h3 id="leave-a-comment">Leave a comment. <em>*Required</em></h3><br />
        {exp:comment:form channel="book" form_class="comment-form"}<br />
         <ul><br />
          <li class="comment-name"><br />
           <div class="label"><br />
            <label for="form-name">Your Name*</label><br />
           </div><!-- /end .label --><br />
           <div class="input"><br />
            <input id="form-name" name="name" type="text" size="35" value="{name}" /><br />
           </div><!-- /end .input --><br />
          </li><!-- /end .comment-name --><br />
     <br />
          <li class="comment-email"><br />
           <div class="label"><br />
            <label for="form-email">Email*</label><br />
           </div><!-- /end .label --><br />
           <div class="input"><br />
            <input id="form-email" name="email" type="text" size="35" value="{email}"/><br />
           </div><!-- /end .input --><br />
          </li><!-- /end .comment-email --><br />
     <br />
          <li class="comment-website"><br />
           <div class="label"><br />
            <label for="form-website">Website</label><br />
           </div><!-- /end .label --><br />
           <div class="input"><br />
            <input id="form-website" name="url" type="text" size="35" value="{url}" /><br />
           </div><!-- /end .input --><br />
          </li><!-- /end .comment-website --><br />
          <br />
          <li class="comment-content"><br />
           <div class="label"><br />
            <label for="form-content">Comment</label><br />
           </div><br />
           <div class="input"><br />
            <textarea id="form-content" name="comment" cols="40" rows="10" />{comment}</textarea><br />
           </div><br />
          </li></p>
    
    <p>     </ul><br />
         <input id="comment-submit" type="submit" value="Submit Comment" /><br />
        {/exp:comment:form}<!-- /end form.comment-form --></p>
    
    <p>        <br />
            <br />
        <br />
                <br />
           <hr><br />
           <br />
        </div><!--end main--><br />
        <br />
      <div id="nav"><br />
            {exp:channel:categories channel="book" style="nested" class="categories"}<br />
      <a href="http://{path=book/section}">{category_name}</a><br />
      {/exp:channel:categories}<br />
      </div>


    I suspect that the reason the contact form does not show, is because, it assumes the page can show multiple entries, rather than a single entry. If this is the case, is there a workaround, or a better way, rather than using categories?

     

  • #2 / Aug 07, 2013 8:15am

    Boyink!

    5011 posts

    Comment forms only display on single-entry templates.

    Why not just have one entry be one chapter? Then commenting would work, navigation would just be a channel:entries loop. Categories work well for pulling in multiple entries into the same bucket but you don’t seem to be needing that here.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases