Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
#39 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
#40 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
#42 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
#43 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
#46 2005-04-08 07:19:39
- davidm
- Member
- From: Paris, France
- Registered: 2004-04-27
- Posts: 719
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
That’s very nice, nimnix, I think I am gonna love this :))
.: Retired :.
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
I found it answering the other question…love the textpattern.org site :D
textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki
Offline
Re: Plugin: pfa_beginning - excerpt generation based on length attribute
yea, i found safe_excerpt while trying to answer my question too. thanks :)
i was thinking — if anyone ever thinks of editing or working on a new excerpt plugin — it would be really great if there were one plugin that could do the following: cut off after so many words AND the paragraph ends; cut off exactly after so many words (possible in kgr_safe_excerpt), and strip the unclosed html tags OR autoclose the unclosed html tags.. something that can print the whole body of the article but strip all the html… something that can strip just all the <p>
, be able to style the ‘read more’ text/link (possible in pfa_beginning)
aside, both kgr_safe_excerpt and pfa_beginning are very useful in their own right. much thanks to both authors
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline