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.

Cropped Channel Entry

March 28, 2013 12:06pm

Subscribe [4]
  • #1 / Mar 28, 2013 12:06pm

    Wyman

    7 posts

    {exp:channel:entries channel="news_articles" limit="3" orderby="date" sort="desc"}
            <div class="news">
                <div class="feeditem">
                    <h4>{title}</h4>
    <p>                {entry_date format="%D, %F %d, %Y"}<br />
                    <div class="feedbody">{body_content}</div><br />
                    <a href="#" class="small gray button">More Info</a><br />
                </div><br />
            </div><br />
            {/exp:channel:entries}

    In the above code I am creating a few news stubs for a news article channel. {body_content} is the full article. What I am hoping to do is crop a small portion; the first couple of sentences perhaps? Is there a parameter to limit length or such? Would I be best served to have a separate channel field for preview text?

  • #2 / Mar 28, 2013 9:25pm

    wildrock

    262 posts

    There’s a variety of addons that can limit characters. You could add a preview or summary field if you want tight control, but there’s lots of other solutions.

  • #3 / Mar 28, 2013 9:33pm

    MadWebDesigns

    147 posts

    I think it’s best you just add a preview field. Less code to run and you have more control over the field length and what info you want to have in there and display. Just my 2 cents.

    Cheers,

    Mike

  • #4 / Mar 29, 2013 6:21am

    infomani28

    5 posts

    HI, Its very simple.

    Just use the following code

    <div class="feedbody">{exp:char_limit total="100"} {body_content} {/exp:char_limit}</div>

    Note: before going to use this char_limit, you must update the third party plugin to as specified location of expressioneengine installed. Download http://devot-ee.com/add-ons/character-limiter

    If still you have any clarification, let me.

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

ExpressionEngine News!

#eecms, #events, #releases