Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2005-02-16 21:07:19
- EddieG5
- Member

- From: Georgia
- Registered: 2004-03-03
- Posts: 96
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
Nevermind … I’ve got it working and it does so perfectly.
Thanks again for the plug-in!!
Offline
#32 2005-02-22 23:31:42
- AlanChandler
- Member

- From: London UK
- Registered: 2005-02-16
- Posts: 11
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
I’ve just tried this plugin with the new 1.0rc3 version of txp.
It seems that the linktext attribute generates a link, but it points to the wrong place
(I have /section/id/title as my clean url. the lintext link seems to only have title in it)
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
To clarify Alan’s post, it outputs the link in RC3 as the following syntax: http://sitename.ext/title, rather than the former http://sitename/section/number/title.
Just for sanity’s sake. :9
The following is true
The above statement is false.
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
Alan, thanks for the update. It’s been a while since I’ve done anything with this plugin and there are a few small tweaks that do need to be addressed.
If I understand correctly, you’re saying that the generated link points to the wrong place when the plugin is used with Textpattern 1.0rc3. If this is the case than I would probably just say that I’ll develop the plugin for RC3 when RC3 is posted on the main Textpattern download page.
For one thing, waiting would allow issues like this to settle. I can already see a proposal that would make this bug a non-issue. You can read that post here
Please let me know if you feel I’ve misunderstood the situation.
Thanks,
Phil
Last edited by philipashlock (2005-02-23 05:44:19)
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
Just FYI while you’re on the upgrade track: I had a problem with some articles going through pfa_begining and trying to validate xhtml.
if the output from pfa_beginning included a list, it got cut off without a closing <code></li> or </ul></code> tag. My siple fix was to add this:
<code>
$beginning = preg_replace(array(‘/<li>/’, ‘/<ul>/’, ‘/<\/ul>/’, ‘/<ol>/’, ‘/<\/ol>/’), ‘<br />’, $beginning);
$beginning = preg_replace(‘/<\/li>/’, ‘’, $beginning);
</code>
right after
<code>
if ($body != $beginning) {
</code>
-Steve
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
I’m having trouble downloading the file as well. 404 error.
Anyone have it? Please Help
Thanks
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
You might want to try contacting the author.
Offline
#38 2005-03-12 13:44:00
- alexbrie
- New Member
- Registered: 2004-09-29
- Posts: 4
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
Ok, for you people out there that had the same problem like me with pfa_beginning having bad permlinks after switching to rc3, here is the quick fix:
Go edit the pfa_beginning plugin, and in about the 10-th line, the one below if($linktext), you replace that line (the one containing <txp:permalink> and the next(the one containing doPermalink)
with the following
$link = “\n<span class=\”$styleclass\”>\n”.permlink($atts, $linktext).”\n</span>”;
This way, instead of artificially inserting <txp permalink> and then removing it via doPermalink(which became obsolete in rc3 and is the one causing the problems), you simply call the function permlink … . This way it works and will probably work for all types or permlinks selected by the user.
Offline
#39 2005-03-12 13:47:53
- alexbrie
- New Member
- Registered: 2004-09-29
- Posts: 4
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
sorry, there were tags all over there(and apparently were removed by the site engine)
it originally read:
the one containing < txp permlink > and the next(the one containing doPermalink)
with the following
$link=… (you keep the rest and replace just the stuff about txppermalink with the call of the function permlink($atts, $linktext) . About the way it appeared above, only there were some span and class tags before and after the \n ‘s .
Hope it will come to you, since I don’t seem to manage to explain it without quoting the code.
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
I would love the modification you made, Alex, but I can’t figure out what you changed… would you please email it to me? Email link’s at the bottom of this post.
Offline
#41 2005-03-15 11:11:21
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
yes Alex, I’m having a few probs with this one and RC3… I can get the permalinks okay using your suggestion above, but not getting the auto excerpt
rev 227 — btw
and you can use < code > < / code >
Offline
#42 2005-03-27 23:59:51
- alexbrie
- New Member
- Registered: 2004-09-29
- Posts: 4
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
Sorry about that.. here it comes(hopefully).
I have no idea what variant of the plugin i’m having.. Probably one of the first ones. Still, here is the plugin text(i hope the code tags will work), with my own tweaks within. I’m also removing the comments. The idea is that the excerpts won’t work because checking for a previous excerpt with “ if ($thisarticle[“excerpt”])” no longer works in this version. I just commented the condition. The final modifications were made ‘cause I want a linebreak after the excerpt. You probably won’t need that.
<code>
function beginning($atts)
{
global $thisarticle;
if (is_array($atts)) extract($atts);
if (!$styleclass) $styleclass = ‘pfab-morelink’;
if (!$length) $length = 350;
if ($linktext) {
$link = “\n<span class=\”$styleclass\”>\n”.permlink($atts, $linktext).”\n</span>”;
}
$beginning = ‘<p>’ . $thisarticle[“excerpt”] . ‘</p>’ . $link;
if ($length < strlen($thisarticle[‘body’])) {
$body = $thisarticle[‘body’];
$i = 0;
$p_end[$i] = strpos($body, ‘</p>’) + 4;
while ($p_end[$i] < $length) { $i++; $last = $i – 1; $more = substr($body, $p_end[$last]); $p_end[$i] = strpos($more, ‘</p>’) + 4 + $p_end[$last];
}
$beginning = substr($body, 0, $p_end[$i]);
if (!((strlen($beginning)+4) == strlen($body))) {
$beginning = $beginning . $link;
}
else $beginning = $beginning.”\n<br />”;
} else { $beginning = $thisarticle[‘body’].”\n<br />”; }
return $beginning;
}
</code>
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
hi, ‘wondering if the feature could be added to excerpt the exact number of words/characters specified—not wait for the paragraph to end.
that would be wonderful :)
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki
Offline