Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2004-12-13 19:26:52

domfucssion
Plugin Author
Registered: 2004-10-23
Posts: 39

Re: Plugin: pfa_beginning - excerpt generation based on length attribute

I have been experimenting with this plugin and noticed that it has problems if the body of the post has any other block level tags than p’s. eg. if a post’s body is just a single blockquote element the plugin searches for a closing p tag – doesn’t find one and leaves the closing blockquote out of the source.

A solution might be to take each substring from the last block level tag – whatever it is, but that is beyond my php skills so I can’t fix it.

How would one code a substring from an array of possible tags? eg. div | blockquote | p | ins | del | pre

note I did not include Hn tags in my array ‘cos that might be silly in this context.

the code fromm the plugin at the moment is:

$p_end[$i] = strpos($body, ‘</p>’) + 4;

what I need to do to hack this plugin is somthing like :

$p_end[$i] = strpos($body, $anyOneOfMyBlockLevelElms) + $theStrLenOfClosingBlockTag;

sorry for such public hacking of your plugin, but I kind of need it to be slightly different.

update:after a bit of messing about i found that the missing tag only hapens when using textile, and seems OK with regular html tags. So I don’t really know what is going on at all.

Last edited by domfucssion (2004-12-13 22:39:56)

Offline

#26 2004-12-14 03:42:17

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

Re: Plugin: pfa_beginning - excerpt generation based on length attribute

I must admit that this plugin was designed for my textpattern based weblog and I wasn’t really putting to much consideration into how the plugin might handle other types of content.

I’ll see about implementing a way to detect other types of tags, but for now, this plugin will only correctly parse content that is enclosed in paragraph tags. As far as I know, textpattern should enclose just about anything you enter in paragraph tags, but maybe someone else understands this situation better than I.

Does every post automatically get wrapped in paragraph tags? If not, what are the conditions that create paragraph tags when content is being entered?

Offline

#27 2005-02-02 18:32:19

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

Re: Plugin: pfa_beginning - excerpt generation based on length attribute

One thing that can be easy to forget with plugins is that after you’ve installed them, they still need to be enabled before they’ll work. In you textpattern admin, on the Plugins page, there should be a list of your installed plugins with a column on the right that sasy “Active”. If the plugin says “No”, just click on the “No” link to make it say “Yes”.

If this isn’t the problem, then you’ll have to give me a better idea of what you’re using for your TP code, in your previous post nothing showed up because you didn’t put your code within the PRE tags:

<pre>

&lt;pre &gt; Put your code here &lt;/pre &gt;

</pre>

Last edited by philipashlock (2005-02-02 18:34:41)

Offline

#28 2005-02-16 20:59:39

EddieG5
Member
From: Georgia
Registered: 2004-03-03
Posts: 96

Re: Plugin: pfa_beginning - excerpt generation based on length attribute

I’m having problems with this plug-in …

I created a form called “ACYA” and have the code:
<h3><txp:permlink><txp:title /></txp:permlink></h3> <txp:beginning length=“25” linktext=“Read More” styleclass=“morelink” />

Now, when I call this form from a page using:

<txp:article_custom form=“ACYA” section=“ACYA” />

I get the title of the article, the first 25 characters and the link to the full article. But when I click on the link, the rest of the article does not show … it appears the same way as it does before – just the title and the first 25 letters.

Am I doing something wrong?

Thanks for your time and the plug-in!

Offline

#29 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

#30 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

#31 2005-02-22 23:38:07

PeterS
Member
From: Cleveland, Ohio
Registered: 2004-03-06
Posts: 38
Website

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

#32 2005-02-23 05:43:48

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

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

#33 2005-02-23 18:10:07

supa
Archived Plugin Author
Registered: 2005-02-10
Posts: 27
Website

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

Board footer

Powered by FluxBB