- Posts: 14
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Extrafield Textarea: Line breaks in non-editor text area not working in frontend
Extrafield Textarea: Line breaks in non-editor text area not working in frontend
- SPOTTERON
- Topic Author
- Offline
- New Member
Less
More
4 years 6 months ago - 4 years 6 months ago #175498
by SPOTTERON
Old member
Extrafield Textarea: Line breaks in non-editor text area not working in frontend was created by SPOTTERON
When configuring the extra field type textarea to be used without editor, the line breaks made in the backend > k2 > item are not taken over in the frontend.
Example:
Textarea box in backend:
This is an adress
with a city
and a post code.
Returns in frontend:
This is an address with a city and a post code.
Can linebreaks without adding HTML codes be used in text areas? The people creating the content of the site do not know HTML and it is right out of a strange world for them:)
Thanks and best regards,
Jonathan
Example:
Textarea box in backend:
This is an adress
with a city
and a post code.
Returns in frontend:
This is an address with a city and a post code.
Can linebreaks without adding HTML codes be used in text areas? The people creating the content of the site do not know HTML and it is right out of a strange world for them:)
Thanks and best regards,
Jonathan
Old member
Last edit: 4 years 6 months ago by SPOTTERON.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 6 months ago - 4 years 6 months ago #175504
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Extrafield Textarea: Line breaks in non-editor text area not working in frontend
You can either modify the foreach loop and wherever you have a textarea type field apply the nl2br() function from PHP or call the field directly (using this guide getk2.org/documentation/tips-a-tricks/display-single-extra-fields-anywhere-in-your-k2-content) and applying (again) nl2br() on it.
E.g. using the 2nd option:
E.g. using the 2nd option:
<?php echo nl2br($this->item->extraFields->EXTRAFIELD_ALIAS_HERE->value); ?>
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 4 years 6 months ago by JoomlaWorks.
Please Log in or Create an account to join the conversation.
- SPOTTERON
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
4 years 6 months ago #175676
by SPOTTERON
Old member
Replied by SPOTTERON on topic Extrafield Textarea: Line breaks in non-editor text area not working in frontend
Thank you very much!
That solution works well, I have changes "name" to "value" since we want to display the extrafield's content, but the suggestion was very helpful!
(closed)
Jonathan
That solution works well, I have changes "name" to "value" since we want to display the extrafield's content, but the suggestion was very helpful!
(closed)
Jonathan
Old member
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 6 months ago #175682
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Extrafield Textarea: Line breaks in non-editor text area not working in frontend
That was a copy/paste mistake. Sorry for that, corrected now.
:)
:)
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Extrafield Textarea: Line breaks in non-editor text area not working in frontend