Recent Topics

1 Sep 18, 2005 23:43    

I know this is totally trivial, but I think it would be cool if I could customize the "read more" text on a post by post basis. In my head I'm thinking when I click on "!M" and get the "

" bit entered into my post I would be able to change that to "<!--more:MY TEXT-->" and get MY TEXT in the read more link. Obviously it still needs a default value from either the skin or the code, and damn but what a trivial point, but hey - it's a feature request!

Okay better still, "!M" gives "

<!--endmore-->" and I stick my custom text between the two bits.

Yeah sure - I'll stop now.

3 Sep 19, 2005 12:25

plugins/toolbars/_quicktags.toolbar.php


		b2evoButtons[b2evoButtons.length] = new b2evoButton('b2evo_more'
																							,'!M'
																							,'<!-'+'-more-'+'->'+'<!-'+'-endmore-'+'->',''
																							,'m'
																							,'<?php echo T_('More [Alt-M]') ?>'
																							,-1
																							);

b2evocore/_class_item.php


if( count($content_parts)>1 )
{	// This is an extended post (has a more section):
if ($flexi_more = substr($content_parts[1],0,strpos($content_parts[1] , '<!--endmore-->' ) ) )
{
// There's a post defined read more link so use it
$more_link_text = $flexi_more;
// We need to strip the "more_text<!--endmore-->" segement
$content_parts[1] = substr($content_parts[1],strpos($content_parts[1] , '<!--endmore-->' ) );
}


;)

¥

4 Sep 19, 2005 20:42

Dude! You rock!!! I tested this in my antiquated and almost obsolete v12 installation without issue or incident. Old posts built with the old readmore work like they used to. I edited a post to use the new-fangled version and got my custom text as the readmore text, and, as you probably knew, it worked like I asked for. I also created a new post just to see what would happen with the new way if I did not customize the text, and got my stock text. In other words, as far as I can tell, this is totally cool!!!

I don't have a category for b2evo-specific linkage, but that's about to change. Without that cat where would I kick out a link to you?

Oh wait a minute. NOW I want to have post-specific text for the anchor after a visitor follows the link :roll: (Just kidding - I use '' for that so the full post isn't interrupted by anchor text.)

5 Sep 20, 2005 10:17

Lol, just read your test post on your blog ;)

As it happens I tried it in Dawn and forgot to try it in older versions ....... guess I'm just lucky huh? :p

¥

6 Sep 22, 2005 18:47

Does this work with multiple 'mores'?

Eg.

Posty posty posty
<!--more-->blaah<!--endmore-->
Back to the main post
<!--more-->More blah<!--endmore-->

7 Sep 22, 2005 19:19

Lol, I dunno, I haven't tried it :p

¥

*edit* nope, guess not :P it'll only take a tad of a tweak though, when I've had more coffee I'll let you know ;)

8 Sep 22, 2005 19:24

I don't want to have to put the <!--more--> tag in manually... I just want it to break my long winded drivel automatically at a certain number of words and let the reader choose whether or not they want to be insulted.

I have a strong feeling that I have missed something terrible in the docs.

Can't I just change something about $MainList->date_if_changed() in my _main.php so that the more prompt happens in the same way with every post?

9 Sep 22, 2005 19:27

I can't remeber which parameter, off the top of my head, but you can limit $item->content() to a specified number of words ..... you just need a method of telling the "more" to display the content after that many words.

¥

10 Sep 22, 2005 19:40

http://doc.b2evolution.net/0.9.0/evocore/Item.html#methodcontent shows the params you can feed that function. What you do is make the format be xml then set cut to the number of words. It will not automatically give you a "read more" link though you would have to use the permalink generating code with some text after the bit where your post loop does "Item->content( param param param )".

11 Sep 22, 2005 20:33

Thanks for pointing me in the right direction. I was looking at the wrong place in the _main.php.

So I figured I try out a little change to get see if I could get something different.... so I changed $Item->content() in the loop to:

$Item->content( $dispmore = 'true' , $more_link_text = 'More::' , $cut=12, $format='raw') ;

fully anticipating that the entries would be truncated. Hmmm. I changed a few of the parameters .... but virtually no difference. So now I'm thinking that I'm an idiot and couldn't hack my way out of a wet sponge.

Or I am just too new to b2evo to understand the docs. Either way, I think I need some special care and feeding.

12 Sep 22, 2005 20:50

Once again, "off the top of my head"

urm.. $dispmore = 'true' .... before cut + more = all ?

¥

13 Sep 22, 2005 20:53

You don't have to identify the param name, but you do have to feed all the parameter values in the order the function expects them. You can often use # to mean "just use your default value" to skip past one and hit the next. Something like

$Item->content( '#', '#',  'More Text', 'More Anchor Text', '#', '#', 'xml' 12 ) ;


Couple of details are worth mentioning. If memory serves the only time $cut is used is when $format is "xml". You might need to put your $cut number inside single quotes, but I doubt it. The two params that come after $cut will assume default, so no need to spell them out.

Give it a shot and see how it goes.

14 Sep 25, 2005 20:37

Well, alas, this worked perfectly... except that my server doesn't support XML markup.

Sigh... thanks for yer help.

Blake

15 Dec 07, 2005 10:55

Any way to do this in Phoenix?

Edit: Nm. Just update the _item.class.php and _quicktags.plugin.php files. Works like a charm.

16 Dec 07, 2005 19:28

Glad you solved it, I haven't released my phoenix version yet as the code is still in alpha and could change at any time, I'll pm you with a link.

¥


Form is loading...