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.

multiple entries for a single channel title entry

February 14, 2011 5:16pm

Subscribe [6]
  • #1 / Feb 14, 2011 5:16pm

    fin

    168 posts

    I’m running 2.1.3. I’m sure the answer to this question is in the documentation, but I can’t seem to find it. I’m working on a book site. There will be a group readers for a particular book. It should work in a similar fashion to a book of the month club. Readers need to add entries as they make progress in their reading. One entry will start a reading for a particular book; however, each reader will add an entry for the same title. I don’t want to use comments for this. What’s the best way to accomplish this? Is this a related entries issue? Thanks for the help.

  • #2 / Feb 15, 2011 12:26am

    You hit the nail on the head.

    ExpressionEngine has a built-in relationship field type, which will allow you to create a custom field for the various entries to be related to a particular book.

    The documentation for related entries can be found here: http://ellislab.com/expressionengine/user-guide/modules/channel/related_entries.html

    In some case you may find that you need a bit more power than the built in relationship field, in which case you can check out Brandon Kelly’s Playa at http://pixelandtonic.com/playa

    I hope that helps get you on your way.

  • #3 / Feb 15, 2011 10:45am

    Sue Crocker

    26054 posts

    Thanks for the assist, Jeremy.

    Fin—does that answer your question? If you do decide to go with Playa, remember that Brandon offers support for his add-on directly.

  • #4 / Feb 15, 2011 10:54am

    fin

    168 posts

    Yes Sue, I think so. I’m actually implementing that right now. One more question to clarify my situation. The example in the documentation talks about music performers. In my example, the writers can comment on a specific book or an original article. I have recreated a channel called comments, and, in that channel, I created two custom fields both with the field type relationship: book-comment and article-comment, I want the readers to make comments on either an article or a book. In order for them to comment on a book or an article I assume the fields can’t be required?

    Ok, I’m having a bit of trouble implementing the related entries into the respective channels. For example, this is how I’ve it set up for the articles channel?     

    {exp:channel:entries channel="articles" limit="2" disable="pagination"
            status="lead article|open"}
                 <dl>
                    <dt><a href="http://{title_permalink=articles/view}">{title}</a></dt>
                    <dd>{article-image}</dd>
                    <dd>{article-excerpt}</dd>
                    <dd><h5>—{author}</h5><p><span>{entry_date format="%F %d, %Y"}</span></dd>            <br />
                </dl><br />
    {related_entries id="article-comment"}<br />
                  <dl><br />
                    <dt><a href="http://{title_permalink=article/view}">{title}</a></dt><br />
                    <dd>{author-image}</dd><br />
                    <dd>{comment}</dd>  <br />
                </dl>    <br />
            {/related_entries}<br />
            {/exp:channel:entries}

    Thanks for the help.

  • #5 / Feb 15, 2011 4:49pm

    Marcus Neto

    1005 posts

    fin,

    How is the user inputting the data for the related entries? And is there a specific reason why you don’t want to use the comment functionality?

    Just trying to figure out the best approach for you and not really understanding why comments would not work in that situation so if you could give me a bit more info I might be able to direct you a bit better.

    Related Entries would also mean either direct access to the CP for each of the participants or an SAEF on the front end of the website using SafeCracker.

  • #6 / Feb 15, 2011 5:05pm

    fin

    168 posts

    Comments seems more like an brief response to another person’s comments about a book whereas a comment from a reader seems more like a longer comment about the book itself? If this book forum goes viral like they usually do :lol: , I may need an alternative. For now, I will be allowing the readers limited access to the CP.

  • #7 / Feb 16, 2011 1:21am

    John Henry Donovan

    12339 posts

    fin,

    Ok, I’m having a bit of trouble implementing the related entries into the respective channels. For example, this is how I’ve it set up for the articles channel?

    What’s the issue? What are you seeing or not seeing as the case may be?

  • #8 / Feb 16, 2011 9:12am

    fin

    168 posts

    Sorry, I should have been clearer. I’m not seeing a test comment I made for a specific book on the published page, i.e. book comment (related field from the comment field group) aren’t showing up in the book channel. I’ve related that field to the book channel.

  • #9 / Feb 16, 2011 4:18pm

    Ingmar

    29245 posts

    Are you using Playa now? My suggestion would be to try with a minimal template first, perhaps use the sample code from the docs. Related entries might take getting used to a bit, but once you do they are a very powerful tool.

  • #10 / Feb 16, 2011 4:56pm

    fin

    168 posts

    Thanks for the reply Ingmar. Is playa necessary? The budget for this project doesn’t allow for it. Yes, that’s the documentation page that I used when I tired to set the relationships up; however, I’ve missed something here, and I’m not sure what. This is an example of what I did for the book page.

    {exp:channel:entries channel:book limit="1" disable="pagination" status="featured book|open"}
            <div id="book">
                {book-entry}
                {related_entries id="book-comment"}
                <h3>{title}</h3>
    <p>            {comment-body}<br />
                {/related_entries}<br />
            {/exp:channel:entries}<br />
            </div>

    I think the problem may be with the {comment-body} field. {book-comment} is a related field to the book channel, but {comment-body} isn’t because the readers need a textarea field for entering their comments. I’ll stop here I may be confusing the issue.
    Again, thanks for the help

  • #11 / Feb 17, 2011 7:46am

    Sue Crocker

    26054 posts

    One thing I’m seeing is that your exp:channel:entries loop isn’t specifying the channel correctly.

    It should be channel=“book”.

    Comments themselves are stored in the database separately from channels. What I’d do is implement something like Freeform, and add a field for the entry_id, then display “comments” - which are actually vetted Freeform entries. Slightly different approach.

    Does that help?

  • #12 / Feb 17, 2011 5:42pm

    fin

    168 posts

    Sue, thanks for the suggestion. I just started working with the Freeform. From what I understand entry_id can sort the type of comment. So I think that’s something I’ll explore. I’ve had some difficulty implementing freeform on the other site on which I have installed it, but I’ll leave that for the solspace forum. Be that as it may, I’d like to fix this related entries problem because as Ingmar said,

    Related entries might take getting used to a bit, but once you do they are a very powerful tool.

    Anyway, this is what the code looks like after I corrected that error; however, the test comment still doesn’t show up.

    {exp:channel:entries channel="book" limit="1" disable="pagination" status="featured book|open"}
            <div id="book">
                {book-entry}
                {related_entries id="book-comment"}
                <h3>{title}</h3>
    <p>            {comment-body}<br />
                {/related_entries}<br />
            {/exp:channel:entries}<br />
            </div>

    Thanks again for the suggestions and the help.

  • #13 / Feb 17, 2011 10:13pm

    narration

    773 posts

    fin, it looks like it should work, so I am guessing the problem is in naming and location of the fields. You can help yourself see where the problem is by putting a little text into your test template. For example:

    - Book entry is: {book-entry}
    - Comment body is: {comment_body}

    This will let you see whether you’re actually listing entries, and then whether the relationships are working, even if the field name isn’t quite right.

    comment_body needs to be a field in the related ‘comments’ channel, or whatever it is named.

    Here’s a similar example I just put up for another support posting: http://ellislab.com/forums/viewreply/859042/.

    You can see there how no_related_entries may be useful to you as well.

    fin, I think that once you have the details accurately so that this example works, then it will be easier to think clearly about the full arrangement you propose. I think it probably depends on how many books would be in review, as far as whether or when you need Playa.

    There’s a scale factor involved, as far as how many books a reader has to sort through, to set the relation to the one they want to comment on. But you will see that, once you get this example operating.

    Regards,
    Clive

  • #14 / Feb 18, 2011 8:14am

    Sue Crocker

    26054 posts

    Thanks for the assist, Clive.

    Fin?

  • #15 / Feb 18, 2011 11:38am

    fin

    168 posts

    Yes, Clive thanks for the help. I think I’m starting see how this might work for this situation. As you said, the book channel needs to have a comment field {book-comment}, and I add another custom field to this channel which is a related field; therefore, I don’t really need a comment channel? I just need to add custom fields to the channels in which a reader can make comments and relate them to a specific book? Does this sound right?

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

ExpressionEngine News!

#eecms, #events, #releases