Hi,
I’m new to EE and new to this plugin, so I hope you’ll be patient with my newbie question….
… but where exactly do I put the tags for the plug in? I currently have the front page of my blog set up this way:
{exp:weblog:entries weblog="default_site" disable="" limit="4"}
<h2><a href="http://{title_permalink=" class="">{title}</a></h2>
{date_heading}
{entry_date format="%d %M %Y"}
{/date_heading}
{body}
<a href="http://{title_permalink=" class="">[click to continue...]</a>
{0 comments}
<hr >
{/exp:weblog:entries}
Should I wrap all of that in the Eexcerpt tag? Should I be replacing something? Thanks for the help.
Cecily: You only need to wrap the plugin tags around what you’re trying to shorten. I’m assuming, in this example you want to make an eexcerpt of the body. So I would do this:
{exp:weblog:entries weblog="default_site" disable="" limit="4"}
<h2><a href='{title_permalink=group/template}' class="">{title}</a></h2>
{date_heading}
{entry_date format="%d %M %Y"}
{/date_heading}
{exp:md_eexcerpt if_exceeds="250" stop_after="100"
the_link="<p class='meta'><a href='{title_permalink=group/template}' class=''>[click to continue...]</a></p>"}
{body}
{/exp:md_eexcerpt}
{0 comments}
<hr >
{/exp:weblog:entries}
That should take the contents of all four {body} tags (you set a limit of 4) and chop them to 100 characters and tack the link onto the end, but only if the body exceeds 250 characters.
Thanks for the reply, Ryan.
When I use the code above, I get this error:
Error
The following tag has a syntax error:
{exp:eexcerpt}
So I used the suggestion up thread about changing the tag to
{exp:md_eexcerpt}
and that seemed to do the trick. Thanks so much for the help and the plugin!
Ryan,
when visiting the plugin manager page the code example has the correct opening tag, but the closing tag is wrong. its missign the md_ prefix.
{exp:md_eexcerpt if_exceeds="60" stop_after="40" append=" →" the_link="<a href='{title_permalink=weblog/comments}’>MORE…</a>”}text you want processed{/exp:eexcerpt}
Oops. Nice catch. I fixed that and pushed the tweaked version to the MD Eexcerpt repo at GitHub.
I was wondering if
if (($theCount <= $stop_after) && ($theCount < $if_Exceeds))
should be
if (($theCount <= $stop_after) || ($theCount < $if_Exceeds))
Perhaps I don’t understand how to use this plugin, but I take
if_exceeds - Text will be truncated if it is greater than this number of words. This parameter must be included.
To mean this plugin will only trim theCount > if_exceeds.
So given the text “The quick brown fox jumped over the lazy red dog” (theCount = 10)
if_exceeds=11 stop_after=9 should not trim, correct?
But if ((10 <= 9) && (10 < 11)) returns false, allowing the script to continue onto trimming… yes? Or am I not following something?
I’m getting an error:
Notice: Undefined offset: 20 in XXXXXX…/plugins/pi.md_eexcerpt.php on line 101
On one of my pages using this plugin, but not on other pages that use it in the exact same way. So it seems like other content or tags on that one page are causing the problem but I can’t find anything.
Any ideas on what might cause that error?
edit went back and read all comments. Looks like it’s still the same old issue where the text is shorter than the exceed limit. I though this was fixed in the newest version but apparently not. Can you please let me know how to fix this issue?
@benek: I’m finding this happens when the content you want to excerpt is exactly the number of characters is the same as one of the parameters. I haven’t tested this in a while, though.
@Stephen (tmoswift): You probably have stronger analytical powers than I do. You’re probably right about that. Looks like this add-on might need a couple updates.
I altered some logic and did a lot of local testing tonight. I used all sorts of combos between if_exceeds and stop_after. I think I have this solved. The new 1.1.1 version of MD Eexcerpt is at GitHub. Give it a shot and let me know if you’re getting any errors.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.