Hi,
I’m wondering what the best way is to pull the first sentence from a Text-field?
is it possible?
Love,
Xx
Hi,
I’m wondering what the best way is to pull the first sentence from a Text-field?
is it possible?
Love,
Xx
That depends on what your definition of a “sentence” is. If you want to get the text before the first dot, it’s pretty easy to do:
echo str::until($page->text(), '.');
But please note that this can easily break if there is a dot mid-sentence. It’s probably better to add a separate field where the first sentence can be manually copied into.