Textpattern Forum

You are not logged in. Register | Login | Help

#11 2006-04-12 08:38:31

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 466

Re: place a "read more link" inside the excerpt element?

@marios
Thank you a lot. This seems to cover exactly what I want. Since I tried “beginning” and it worked, I didn’t try that way though (yet).

@nardo
Thank you very much. It seems that this is the solution for my question. Since I only need this for articles with existing excerpts (in article-lists), I didn’t try it before.

Now I’m wondering what exactly is the difference between both plugins.

And Thank You Very Much all in this helpful forum :)

Last edited by saccade (2006-04-12 08:40:53)

Offline

#12 2006-04-12 18:08:39

marios
Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: place a "read more link" inside the excerpt element?

There is a couple of differences, pfa_beginning does only charcter count,kgr_safe_excerpt does both word and char and is more customizable.
pfa_beginning though has a couple of if else clauses that can let it output just a permlink url title display (wrapped with div),if a certain char set count value is not met (It would then calculate the number of paragraphs, that in total do not exceed the value of char count value set ).
I therefore prefer kgr_safe_excerpt, which gives me more accurate results.(Allso prevents broken HTML)
It allso will use the article body, in case there is no excerpt.

I believe, you would use pfa_beginning, if you would like your paragraphs not to be truncated(Like for important information), but do not care about layout Issues otherwise, like for Teasers.

EDIT.:Consider above info as not accurate,I hadn’t realized that pfa_beginning has merged into Beginning,it’s kind of difficult to track so many plugins anyway,so the penny has dropped now for myself as well, thanks.

regards, marios

Last edited by marios (2006-04-12 18:26:24)


⌃ ⇧ < ⌃ ⇧ >

Offline

#13 2006-11-13 09:11:11

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 466

Re: place a "read more link" inside the excerpt element?

Having trouble with an up to now working solution,
I want to bring this back to discussion.

My question
How can I place the “read-more”-permlink within the last test-paragraph of an existing exzerpt?
(without having to place it manually!)

Perhaps I did miss something and this is possible by txp-on-board-tools. But I didn’t find anything. Any tipps?

So far I see the following scenario:
In existing excerpts the end can have different code:

  • Sometimes ending simply with </p> (the normal case in txp 4.0.4)
  • When users write an empty line (double return) at the end, then there is a </p> followed by two paragraphbreaks
  • In older dataentries coming from txp 4.0.3 there is a </p> followed by two paragraphbreaks and a space
  • If there is an image in the excerpt the last tags may be different. In txp 4.0.4 it normally seems to be a </p>, but I think there may be other scenarios too.

At the moment I’m using the plugin “beginning”. But I only use the function to place a permlink within existing exzerpts. Maybe it would be better if there was an extra small plugin doing this – or much better an attribute in txp_excerpt, placing permlinks.

The plugin “beginning” simply strips an amount of characters from the end and replaces a </p>-Tag – this way running into problems.

So to place the read-more-permlink correctly we have to find out the right ending tag and placing the link just before.

This seems to be manageable by a simple code.
But how?

Offline

#14 2006-11-13 15:00:43

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,390
Website

Re: place a "read more link" inside the excerpt element?

Does this post help you? It only requires that users put a txp tag in the excerpt.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#15 2006-11-13 15:15:50

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 466

Re: place a "read more link" inside the excerpt element?

Ah, thank you! For me it’s interesting and helping.

But my users barely read instructions (even my empathetic instructions – sigh) and follow the main steps writing an article, setting the right category …;
and I don’t want to bother them with too many additional tasks like typing/copying those tags.

And I think this is a task, the machine could and should do pretty easy.

What would help me (shame I didn’t learn php yet!):
The main question is: How can a php-code find and possibly eliminate the last </p>-tag in a string? (for this seems to be set in excerpts in most cases)
And possibly stop, if there is another text apart from spaces and paragraphs? (for special scenarios)

Then it would be easy adding the permlink and provide a closing </p>-Tag as the plugin “beginning” does it.

Offline

#16 2006-11-13 21:57:03

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,390
Website

Re: place a "read more link" inside the excerpt element?

If you can be sure there won’t be any other html code in the excerpts except the <p> tags, you could probably use etz_striptags.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#17 2006-11-13 22:01:48

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 466

Re: place a "read more link" inside the excerpt element?

I fear I can’t be sure, for sometimes there will be images.
And of course br-Tags.
Will this strip all tags or just the beginning and ending p-Tags?
If the last, that would be just the matching code for my problem.

Offline

#18 2006-11-13 22:15:20

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,390
Website

Re: place a "read more link" inside the excerpt element?

I’m afraid it strips all tags. But you could make a plugin request, I’m not a coder myself, but I don’t think it’s very hard to do with php.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#19 2006-11-13 23:17:58

marios
Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: place a "read more link" inside the excerpt element?

@saccade
What I don’t really keep understanding, is, why you need the link inside the last p tags?
With the current tags und plugins, you can put the read more title text inside a custom field, and have it automaticlly appended as the last paragraph, after there already is generated by textile.
Then, as a fallback value, in case nothing was entered, it’ll be something like :
Read more of this …..

I couldn’t think of a regular expression, that would match the last paragraph of a document and then in php there are used different.

regards, marios

Last edited by marios (2006-11-13 23:21:49)


⌃ ⇧ < ⌃ ⇧ >

Offline

#20 2006-11-14 06:14:40

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 466

Re: place a "read more link" inside the excerpt element?

@marios

Let me describe why I want the link to be inside:
In my matters of content normally excerpts will be one or more paragraphs of text to give some view on the following and make it interesting to continue reading. This text mostly will be a truncated copy of the first sentences of the full body.
So the “read more” is semantically a part of the text and not a new paragraph.

Of course I could place it by CSS inline at the end of the text paragraph, but that seems to be not a good solution for me.

I have plain HTML without CSS in mind too. There it should look well ordered too:
So for accessibility (for example viewing without CSS on a mobile) I think it is better to have the plain “read more”-link inline at the end of the last paragraph of the excerpt.

It should look like this:

New image gallery
We’ve posted the images from last weekend. A bunch of fotographers didn’t stop working. There were taken more than 1000. You will find that … read more …

It should not look like this:

New image gallery
We’ve posted the images from last weekend. A bunch of fotographers didn’t stop working. There were taken more than 1000. You will find that …
read more …

In plain HTML a separated read-more-link also will be separated additionally by paragraph leading from the paragraph before (that doesn’t show here). Exactly that I don’t want.

The customfield solution also produces a separated paragraph.
But also I don’t want my users have to fiddle anything – it showed, that using a customfield is too complicated for them (sigh). It is not a problem of the title text.
It should work automatically.

Last edited by saccade (2006-11-14 06:19:29)

Offline

Board footer

Powered by FluxBB