Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-04-10 17:05:02
- saccade
- Plugin Author
- From: Neubeuern, Germany
- Registered: 2004-11-05
- Posts: 521
place a "read more link" inside the excerpt element?
I would like to place a “read more”-link inside the element of an excerpt –
and for excerpts seem to be covered in p-elements by default, so it should locate before the /p-Tag.
I don’t want to do it by putting the link into the excerpt-form-field, but by including it into the article-form by default.
I couldn’t find any hint in the forum so far.
I tried to manage by setting it outside (an extra p) and defining as inline by CSS, but that is not really what I want, because I want to have clean code without css too – and then a link located within the excerpt-paragraph.
Only the plugin “beginning” is working the way I think of: placing the read-more-link within the excerpt-element. But I need this working for articles that already have an excerpt.
Is there any solution or something I missed to try?
Offline
Re: place a "read more link" inside the excerpt element?
I would appreciate some feedback on this too. Currently I just write an anchor tag with a link that says “Read More” right in the excerpt.
Offline
#3 2006-04-10 17:45:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: place a "read more link" inside the excerpt element?
You can either turn off Textile for the excerpts (under Advanced options), or begin your excerpt with a space, which will prevent the paragraph to be textiled. And then in the article form <p><txp:excerpt />...<txp:permlink>read more</txp:permlink></p>
.
Last edited by els (2006-04-10 17:45:43)
Offline
Re: place a "read more link" inside the excerpt element?
Michael,
What’s going on? I haven’t seen you around in awhile. I hope you are well man. I miss our conversations :)
I think that’s got to be a hard coding thing. the <code><txp:excerpt /></code> tag would have to be changed somehow in taghandlers.php, but don’t ask me how, I am only guessing there.
You’re main concern must be for the link to be inside the same paragraph for text-readers and other non-css compatible readers? yes?
Otherwise I guesss you would have styled it into place?
Hmm. I wonder what will come of this one?
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
#5 2006-04-10 19:26:47
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: place a "read more link" inside the excerpt element?
You could do something like this, using the specific plugin(There are actually two of them , the other one is from Nicos, etz_strip_tags,
or using inline php, whatever you prefer.
<code>
<p><txp:sab_striphtml><txp:excerpt /></txp:sab_striphtml> …I need more…</p>
<p><txp:title /></p></code>
The disadvatage of this is, that you only have one pargraph then, if your excert is very long, this would be more annoying then having it wrapped in seperate p tags which IMHO is not un semantic, since you could address this as <code><p class=“more”></code>
regards,marios
Last edited by marios (2006-04-10 19:28:09)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: place a "read more link" inside the excerpt element?
Whoa. I did not know about the striptags plugin. That’s really really interesting!
Thanks Marios.
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
#7 2006-04-10 20:48:25
- saccade
- Plugin Author
- From: Neubeuern, Germany
- Registered: 2004-11-05
- Posts: 521
Re: place a "read more link" inside the excerpt element?
@matthew
I miss our conversations too. Hope time will grow again in spring (and having some beer in the sun!) :)
You’re main concern must be for the link to be inside the same paragraph for text-readers and other non-css compatible readers? yes?
exactly. it makes more sense
Otherwise I guesss you would have styled it into place?
I’ve done that. But it is not convenient for me. It seems more logic to have it inside the surrounding element for the excerpt.
@els
Thank you. That is a first solution.
But for the people who should continue using the website it would be much better if textile could be active anyway. It’s hard to tell them that in the excerpt-field they have to follow (different) rules of writing.
@marios
Thank you. Didn’t know that there is such a plugin. But loosing paragraphs could be hard.
But let me kno more about the php-thing: Could it be possible used to strip only the last /p-Tag – and place it after the link-code?
Something like: <code><txp:excerpt /><php strip /p> read more …</p></code> ?
Offline
#8 2006-04-10 23:20:53
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: place a "read more link" inside the excerpt element?
I’m not php-literate enough, but I believe that a function like preg_match_all with the right regular expression woud be necessary to match only the last paragraph before you can use the other function that strips the p tags.
For inline php in TXP the TXP php code convention must be used.
like this<code><txp:php>code here</txp:php></code>
I think that this would be a nice option for kgr_safe_excerpt, you could place a request there.
regards, marios
Last edited by marios (2006-04-10 23:21:37)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#9 2006-04-10 23:45:22
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: place a "read more link" inside the excerpt element?
UPDATE, I made a little research at the relevant thread as well, I think you can do what you want,
Using This little mod to the kgr_safe_excerpt_plugin,
I’ll try that myself as well, since it could come in handy for some other purpose.
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#10 2006-04-11 05:15:56
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: place a "read more link" inside the excerpt element?
check out the beginning plugin
Offline
#11 2006-04-12 08:38:31
- saccade
- Plugin Author
- From: Neubeuern, Germany
- Registered: 2004-11-05
- Posts: 521
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
- Archived 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