Textpattern Forum

You are not logged in. Register | Login | Help

#1 2006-04-10 17:05:02

saccade
Plugin Author
From: Raubling, Germany
Registered: 2004-11-05
Posts: 462

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

#2 2006-04-10 17:36:06

alexburr
Member
From: Rochester, NY
Registered: 2006-02-20
Posts: 14
Website

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
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

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)


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

Offline

#4 2006-04-10 17:46:41

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

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?


Offline

#5 2006-04-10 19:26:47

marios
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

#6 2006-04-10 19:59:31

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

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.


Offline

#7 2006-04-10 20:48:25

saccade
Plugin Author
From: Raubling, Germany
Registered: 2004-11-05
Posts: 462

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
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
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: 739

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

check out the beginning plugin

Offline

Board footer

Powered by FluxBB