mel47 Posted January 23, 2017 Share Posted January 23, 2017 Hi I have a simple question but I'm unable to find answer. I have a summary field with CKeditor. When I want to render this field, It always get wrapped by a <p>text</p>. But I don't want those paragraphs. How to remove them? If I use $sanitizer, it also removes other tags (<a>). Thanks Link to comment Share on other sites More sharing options...
blynx Posted January 23, 2017 Share Posted January 23, 2017 maybe this helps for further research: otherwise, also mentioned there as a quick and somewhat dirty hack: <?php echo str_replace(['<p>', '</p>'], ['', ''], $page->summary); 1 Link to comment Share on other sites More sharing options...
Robin S Posted January 23, 2017 Share Posted January 23, 2017 1 hour ago, mel47 said: But I don't want those paragraphs. Why not? Seems like a paragraph tag is the appropriate markup for a paragraph of text. 2 Link to comment Share on other sites More sharing options...
mel47 Posted January 25, 2017 Author Share Posted January 25, 2017 On 2017-01-22 at 9:55 PM, Robin S said: Why not? Seems like a paragraph tag is the appropriate markup for a paragraph of text. Yeah, I think it is the problem. I don't want to use it as a paragraph. I considering changing to a different field. Link to comment Share on other sites More sharing options...
adrian Posted January 25, 2017 Share Posted January 25, 2017 12 minutes ago, mel47 said: Yeah, I think it is the problem. I don't want to use it as a paragraph. I considering changing to a different field. Depending on your needs, you could set margin:0 for the p tag in the required div, which would make it look like a normal line break. But again, this may not be appropriate, but it is another potential option. You might also try CKEditor settings for that particular field to not add p tags in the first place: http://stackoverflow.com/questions/3339710/how-to-configure-ckeditor-to-not-wrap-content-in-p-block 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now