HashandSalt / chopper

This plugin creates excerpts and keeps HTML tags.
MIT License
26 stars 2 forks source link

Doesn't work with v3.1.1 #1

Closed S1SYPHOS closed 4 years ago

S1SYPHOS commented 5 years ago

I just used this example:

<?= $page->yourtextfield()->chopper(50, 'words', '→') ?>

.. but it doesn't output an arrow at the end. The rest works like charm also doesn't work?!

S1SYPHOS commented 5 years ago

Still not working .. v3.1.3

HashandSalt commented 5 years ago

Hrm... sorry.... seems github failed to tell me about this issue.... i'll take a look

S1SYPHOS commented 5 years ago

Thanks very much! Looking forward to a solution, Kirby's built-in excerpt() is just horrible :slightly_smiling_face:

PHP: 7.3 Kirby: 3.1.3

HashandSalt commented 5 years ago

It's possibly a PHP 7.3 issue.... it works fine for me on 7.1 with last release of Kirby.

If i can get 7.3 running, I'll see if i can fix it.

HashandSalt commented 5 years ago

Well i got PHP 7.3.2 running on my machine, along wit Kirby 3.1.3. I ran the plugin on a fresh starter kit and it works just fine. Have you got anything funky going on in your project?

S1SYPHOS commented 5 years ago

I wonder what it could be .. I'll have to dig into your code, then .. :confused:

HashandSalt commented 5 years ago

Did you manage to figure out? What was it? And can i close this ticket?

S1SYPHOS commented 4 years ago

I guess .. updating to the latest version did the trick, in the end.

One thing: How would I go about making the last argument a link?

<?php
  $more = Html::tag('a', '→ Read more', [
    'href' => $post->url()
  ]);
?>
<?= $post->text()->chopper(40, 'words', $more) ?>
HashandSalt commented 4 years ago

Not sure i understand what you mean there. You want to append link to it or make the whole chopper output a link?

S1SYPHOS commented 4 years ago

I'm trying to append it, but the <a> tag comes out as text

HashandSalt commented 4 years ago

Hmm, personally i just make a link under it, and set the apperend charachter to nothing. If i get some time ill mess around with it.

S1SYPHOS commented 4 years ago

That's what I did, but coming from WordPress (as some people might still do), where you can append a read more link in that exact spot (being tied to the excerpt), that might be good to know / have.

I mean, why put in an ellipsis (or whatever) if it can't link to the article, right? It's the post's basic indicator like 'follow me, I has contentzz'

// Edit: Anywhoozle, I like that I can display a specific word count now, thanks so much!