Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[archived] ede_beginning (pfa_beginning update)
Notice: This thread is archived, this pluginis no longer available.
**********************************************************
I have added some functionality to the pfa_beginning plugin (see this thread ).
This plugin automatically generates an excerpt based on a length attribute.
The plugin appeared not to be actively developed and I needed some of this, so I hope I’m not treading on any toes here. All the credit should go to Philip Ashlock for his concept and hard work that made the original plugin.
Two features I’ve added are:- The choice of having the ‘read more’ link inside the excerpts closing paragraph tag.
- The ability to specify the linktext attribute from a custom field in the article.
I’m only learning PHP and this is my first plugin, so this comes with absolutely no gaurentee at all. It works on my test site (TXP 4.02), but I can’t say more than that.
Once you have installed the plugin, you should make sure pfa_beginning is disabled before you enable this one. I doubt they play nicely together, however ede_beginning should replicate pfa_beginning without you having to change your site. I have tried to keep it backwardly compatible.
More information here: http://www.bombsites.co.uk/index.php?id=19
Download here: http://www.bombsites.co.uk/files/ede_beginning.txt
I hope this is useful to some people, let me know how you get on with it.
Cheers,
Ed.
ps, Thanks to Maniqui for encouraging me to get this out as a plugin.
Last edited by edeverett (2005-11-22 13:33:29)
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Thank you vary much for this plug-in, edeverett!
I will try it right now!
The ability to specify the linktext attribute from a custom field in the article.
That is a very cool and clever attribute.
I have read some accesibility advices against using always the same “read more” link more than once in the same page.
So, this attribute seems to be a perfect solution.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
To clarify:
the tag to use this plug-in is <txp:beginning />
.
That is because, as edeverett said, it’s backward compatible with pfa_beginning.
@edeverett: the plug-in help looks a bit “messy”, i mean, it is a big paragraph, without line-breaks nor styles.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
I have a little issue in Firefox. In fact, it is a Firefox issue, because it doesnt happen in IE6/Opera
The plug-in outputs nice HTML, but it break it in some lines, like (content and attributes value deleted for brevity):
<code>
<p>Blablablablaa.
<span class=“readmore”>
<a href=”“ title=”“>Continue.</a>
</span></p> </code>
Notice the line-breaks in the code.
In Firefox, that causes a noticeable visual extra gap if you have the bad luck that the “Continue” link is the first word in the final line. I mean, if the “Continue” link falls at the beginning of a new line, for wrapping causes. Do I explain myself?
This is a FF issue, because there is no reason to change the visual layout because the source is breaked in various lines.
The solution (very easy):
Find:
<code> // Add closing </p> tag after link $link = “\n@<span class=\”$styleclass\”>@\n”.permlink($atts, $linktext).”\n@</span></p>@”; } else { $link = “\n@<span class=\”$styleclass\”>@\n”.permlink($atts, $linktext).”\n@</span>@”; }
</code>
And change it to:
<code> // Add closing </p> tag after link $link = “ <span class=\”$styleclass\”>”.permlink($atts, $linktext).”</span></p>”; } else { $link = “ <span class=\”$styleclass\”>”.permlink($atts, $linktext).”</span>”; }
</code>
<p>Notice that I have removed all the \n
, and also add an space before the span: <code> “ <span …> “ </code> (to keep the link separed from the last dot of the sentence) </p>
This will output the code for the excerpt in a single line, following the last sentence of the paragraph, like this: <br />
<p>Blablablablaa. <span class="readmore"> <a href="" title="">Continue.</a> </span></p>.
That’s all!
Last edited by maniqui (2005-11-23 15:23:01)
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Thanks for checking it out Maniqui,
I’ve updated it with your suggestion to get rid of any potential line break problems. I’ve also sorted out the help text, it’s html now, before I just copied and pasted it without thinking. Fixed. Download the new version from the original location.
Yes, as pointed out the plugin uses the <txp:beginning />
tag just like the pfa_beginning plugin, but adds more features.
Ed.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Great additions to the pfa_beginning plugin! This is exactly what I was looking for.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Thanks ed this is a great plugin. I have a couple of requests though. I think the styleclass should go on the a tag and get rid of the span tag or a least have that as an option. Also, could you make it so that setting styleclass=”“ removes the class altogether?
Thanks,
Jeff
Refresh Dallas and other Refreshing Cities.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Thanks Jeff,
Glad you like the plugin.
Yeah, using the span tags is not the neatest output, but I was wanting to keep backwards compatibility with the pfa_beginning plugin that I based this on. I guess the plugin could have an option to output either though as you suggest.
I’ll have a look at making the styles behave as you suggest. It might be that it has to have some value to over-ride the default. Would it be acceptible to have something like styleclass=“no-style” to remove the class attribute?
Thanks for the good suggestions.
btw. There is also a txp:notbeginning tag in the works that outputs everything that isn’t output by the txp:beginning tag. I’m not sure how useful this is, but it was requested in an email and it certainly won’t hurt.
Cheers,
Ed.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Would it be acceptible to have something like styleclass=“no-style” to remove the class attribute?
This would be fine though I have seen other plugins that allow you to set the attribute styleclass=”“ to remove that attribute. Thanks again.
Refresh Dallas and other Refreshing Cities.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Great new features!
As you are updating the plugin, one question.
I get the “more”-Link sometimes, although there is no further text, which will be displayed is the individual article view.
When I look in to the plugin, it should check, if the created excerpt is the entire article. In this case, there should be no “more”-link.
Offline
Re: [archived] ede_beginning (pfa_beginning update)
Second issue:
Sometimes I’m using the excerpt-field for the part before the more-link. In this case, the last fullstop is removed, option inside is chosen.
workaround:
if($format == ‘inside’ ){
//Remove closing </p> tag from existing excerpts. (not sure why we need to remove 8 characters)
$clipped = substr_replace($thisarticle[“excerpt”],”“,-7);
$beginning = $clipped . $link;
}@@
just remove 7 characters.
Last edited by The-Exit (2006-01-26 20:28:57)
Offline
Re: [archived] ede_beginning (pfa_beginning update)
tinyfly - this feature has been added. Simply specify the styleclass attribute with styleclass="0" to prevent an html class attribute from being generated.
The-Exit – this bug should be fixed
I’ve fixed some bugs, added a minor feature, cleaned things up a bit and revised some of the plugin metadata to be more representative of its collaborative authorship. Because the plugin shares so many authors, I thought it would be appropriate to drop the initials that precedes it, so pfa_beginning and ede_beginning can simply be maintained as Beginning. The new thread for this plugin, with links to download can be found with this information:
Name: Beginning
Version: 0.6
Author: Collaborative, See Below
Author URL: http://forum.textpattern.com/viewtopic.php?pid=96955
Modified: 2006-01-27
Download URL
Discussion Thread URL
Last edited by philipashlock (2006-01-27 10:52:00)
Offline