Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-27 10:49:46

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

[plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Before using this plugin, I’d recommend that you consider using rss_auto_excerpt instead as it resolves some limitations with this plugin.

Note: For those familiar with using previous versions of the plugin (pfa_beginning or ede_beginning) this is simply an update of those plugins with a new name, so it remains backward-compatible with sites developed around recent versions of those plugins. This new version is meant to replace those older versions, so do not have both old and new versions enabled on your site at the same time.

Name: Beginning
Version: 0.6
Author: Collaborative, See Below
Author URL: http://forum.textpattern.com/viewtopic.php?pid=96955
Modified: 2006-01-27
Download version 0.6 for Textpattern 4.0.3
Download version 0.7 for Textpattern 4.0.4
Author’s plugin page
Discussion Thread URL

Summary: This plugin automatically generates excerpts from the body of each article based on attributes you provide. Attributes include, length of excerpt, text of a “read more” link, the css class applied to a span that wraps around this link, the format of the link (inside or outside the paragraph), and the name of a custom field to use to specify the “read more” link.

Authors:
Philip Ashlock
Ed Everett
schmoboy
Kurt Raschke
Julian Stahnke
alexbrie

From the Plugin Help:

Plugin attributes:

  • length=”xxx” – The number of characters before the plugin generates the excerpt at the end of the current paragraph. Default is 350.
  • linktext=”Read More” – The text to be displayed as the permalink to the rest of the article
  • styleclass=”morelink” – The css class applied to the link. Default is ‘read-more’. A value of “0” will prevent a class attribute from even being generated in the html.
  • format=”inside” – This sets whether the ‘read more’ link is placed inside the excerpts paragraph or not. If the value is not set or not ‘inside’ then the plugin will revert to the default (original) format of placing the link after the excerpts closing paragraph tag.
  • cfield=”continue” – This sets the name of the custom field to check for an alternative link text. The default custom field name is continue and the if the custom field is empty the plugin will use the value set by the linktext attribute.

Example tag:
<code>
<txp:beginning length=“250” format=“inside” linktext=“Read More” styleclass=“morelink” cfield=“continue” />
</code>

What about pfa_beginning and ede_beginning?

This is the outgrowth of these plugins, just without authors’ initials preceding the name of the plugin. The Beginning plugin is backward compatible with pfa_beginning and ede_beginning. This plugin replaces those earlier versions, so do not have multiple versions (pfa_beginning, ede_beginning, Beginning) enabled at the same time. The only change from earlier versions is the name of the plugin, a bug fix, and the default value for the styleclass attribute, which is now “read-more”.

Plugin Credits:

This plugin was initially developed and maintained by Philip Ashlock, but has been maintained with the code and collaboration of several additional people including: Ed Everett, schmoboy, Kurt Raschke, Julian Stahnke, alexbrie, and who’s next?

Code Maintenance:

Since the plugin is the result of several people’s work, it will no longer be referred to as either pfa_beginning or ede_beginning, but instead simply Beginning. The convention of using the author’s initials before the name of the plugin is not compatible with collaborative authorship, so in this case it will be dropped. As the initial developer, I ask that this plugin be kept open-source and that all contributors be credited. This plugin uses a Creative Commons Attribution-ShareAlike 2.5 license.

Last edited by philipashlock (2008-01-15 06:10:19)

Offline

#2 2006-01-27 11:02:52

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

May I suggest an additional feature for this lovely plugin?

Could the more-Link contain an anchor, so that users can jump directly to the paragraph wich is after the “break”? This means, that you have to put the anchor-tag also in the string of the article, but you are anyway splitting the string, aren’t you?

Offline

#3 2006-01-27 11:17:10

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I’m not sure that I understand your request. I’ve made a very simple example of the tags used when rendering this plugin. Maybe you could specify where you would like this additional anchor tag to go by looking at this example. Maybe even if you were to refer to one of the numbers to help clarify where you would like it to be.

Also, I’m trying to understand the use of this. You want an anchor to go to the next paragraph “after the break” – so do you mean you want the anchor to be an anchor to the article which would follow the current one? If that’s the case, then it would make more sense to put the anchor on that next paragraph or on the link/header for the next paragraph.

<code>

<p> 1. article text </p>

2.
<span class=“read-more”>
3.
<a>read more</a>
</span>

</code>

Last edited by philipashlock (2006-01-27 11:17:49)

Offline

#4 2006-01-27 11:56:45

thomasstache
Member
From: Dresden, Germany
Registered: 2005-01-18
Posts: 14
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

That’s a Movable Type feature, on some blogs the “read more” link points to an anchor in the article.
Example Link

So I guess that’s beyond the scope of Beginning, since it isn’t involved in the article page.


Thomas Stache

Offline

#5 2006-01-27 12:18:57

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Yeah, that makes sense. Sounds like a really cool feature, but I don’t think I’d have any way to implement it.

Offline

#6 2006-01-27 12:40:37

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I think it should not be too complicated.

First of all, you add “#more” to the link.

Then you insert < a name=”#more” > < /a > in the article.

At the moment, your plugin takes the content von the body and you “cut” it into two pieces. The first one is the teaser.

For the individual article, you take the teaser-string, you add the anchor and you add after it the rest of the article. This part, we cannot insert so far into the template. For this, we’d need a new tag (e.g. txp:beginning_more) which we use instead of the body tag.

Is this too complicated?

The problem is, I do not have any clue how the code in php. So I can just try to think of ways and logic for this string manipulation.

Last edited by The-Exit (2006-01-27 12:42:28)

Offline

#7 2006-01-27 14:38:08

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Hi!

I have to try this new version yet.

I would like to suggest a new feature, that I think it can be implemented as a new tag.

The tag should be something like <txp:beginning_link /> and should work only when format="outside".

With this tag, user will be able to choise where to put the “read more” link. For example, inside an unordered list with all the article metadata, like:

<code><txp:beginning length=“250” format=“outside” />
<ul>
<txp:beginning_link linktext=“read more” styleclass=“more” wraptag=“li” />
<li><txp:posted /></li>
<li><txp:author /></li>
</ul></code>

If the plug-in generates an excerpt (and doesnt show the full article), that will output something like:

<code><p>This is the excerpt of the article.</p>
<ul>
<li><a href=“http://www.example.com/section/myarticle”>Read more</a></li>
<li>26 days ago</li>
<li>Pirulo Smith</li>
</ul></code>

Finally, this suggested <txp:beginning_link> may also be a container tag, like

<txp:beginning_link wraptag="li">keep reading My Article</txp:beginning_link>

Last edited by maniqui (2006-01-27 14:38:47)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2006-02-17 14:46:09

instantok
Member
Registered: 2004-08-10
Posts: 20

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

i have a suggestion for improvement. rather than wrapping the “read more” link in a span, which in turn has a class applied to it, simply apply the class directly to the link making for lighter markup. this could be useful in conjunction with some of the suggestions mentioned by maniqui.

also, i’m having a bit of trouble with the closing /> being stripped off of images included in the excerpt. i’ve had this problem elsewhere with textpattern so i’m not sure if it’s something that can be addressed.

Offline

#9 2006-02-19 17:20:39

nicklas
Member
Registered: 2004-04-13
Posts: 12
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I’m not sure if it’s textpattern or the plugin, but with TXP 4.0.3 I get a “read more”-link if it displays two paragraphs even if it’s nothing more to be read.

Offline

#10 2006-03-18 05:42:44

treffynnon
New Member
Registered: 2005-06-17
Posts: 6

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Here are my additons to the plugin. They are in action on my site Simon Holywell .

I have added an ellipsis which can easily be styled and custom field for the length of the excerpt as I wanted to have better control on an article by article basis.

Here is a demo call string:
txp:beginning lfield=“excerptlength” format=“inside” linktext=“Read More” styleclass=“morelink” cfield=“readmorelink” ellipsis=“true” length=“350”

The call string from my site:
txp:beginning lfield=“excerptlength” format=”“ linktext=“Read More” styleclass=“morelink” cfield=“readmorelink” ellipsis=“true”

Its too bloody hard to post code in this forum!!!
So get it from this text file.

Last edited by treffynnon (2006-03-18 05:51:41)

Offline

#11 2006-05-25 03:27:57

semanio
Member
Registered: 2005-10-18
Posts: 20

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

philipashlock,

I see one bug with this plug-in. The plugin fails to generate an excerpt if the ending length falls between a OL, UL or LI tag. Meaning if I have a list starting within the first few hundred characters it cannot handle this or it thinks the article is too short and ends up displaying the entire body.

Any suggestions on how to fix this?

Nate

Offline

#12 2006-06-07 04:32:50

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 741

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

download URL appears broken – can anyone assist?

Offline

Board footer

Powered by FluxBB