We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Possible problem with pi.eexcerpt.php plugin

Development and Programming

OutofControl's avatar
OutofControl
164 posts
16 years ago
OutofControl's avatar OutofControl

I came across one page that gave this notice (yes it is only a notice, but I hate notices in my code almost as much as errors):

Notice: Undefined offset: 50 in /home/c/6/3/22238/22238/public_html/content_mgt/plugins/pi.eexcerpt.php on line 80

The code at line 80 is

for ($i = 0; $i < $stop_after + 1; $i++) 
{
            $str .= $word[$i]." ";
}

Changing line 79-81 to the following fixes the notice. Presumably since $word is an array of words and $stop_after is the number set in the tag pair, if $stop_after happens to hit exactly the number of words being checked, then the for loop would exceed the $word array by one, giving the notice above. I might be way off base, but removing the +1 fixed my notice issue:

for ($i = 0; $i < $stop_after; $i++) 
{
            $str .= $word[$i]." ";
}
       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

plattapuss, I assume we are talking about Ryan Masuga’s plugin? Let me move this to the plugin forum for you.

       
OutofControl's avatar
OutofControl
164 posts
16 years ago
OutofControl's avatar OutofControl

Sorry, I looked at the header of the file and saw

ExpressionEngine - by pMachine
-----------------------------------------------------
 http://www.pmachine.com/
-----------------------------------------------------
Copyright (c) 2003 pMachine, Inc.

Now I see further down:

Based on: pi.word_limit_plus.php Modified: 02 26 2007 by Ryan Masuga

Thanks for moving this for me.

       
Morsekode's avatar
Morsekode
6 posts
16 years ago
Morsekode's avatar Morsekode

I was having a similar issue, Ryan updated his plugin just last Friday. Read the last 2-4 posts on this message and download his new plugin from GitHub. It works beautifully for me now.

       
OutofControl's avatar
OutofControl
164 posts
16 years ago
OutofControl's avatar OutofControl

Ha, figures. I only downloaded it a couple of weeks ago I think for the first time. Cool little plugin. Thanks for pointing to the proper thread MorseKode.

— ..- - — ..-. -.-. — -. - .-. — .-..

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.