Confusion: p-tags in blocks become div style=margin:0
Permalink
Something very odd happens here in my code :-D
I have a custom block type where I can add content via the TinyMCE editor. When I look at blocks I've created with this block type directly they all display fine.
But when I grab one of the blocks somewhere else on the page in a view like so
the p-tags become <div style="margin:0"> ?!!?
See pic attached...!
I have a custom block type where I can add content via the TinyMCE editor. When I look at blocks I've created with this block type directly they all display fine.
But when I grab one of the blocks somewhere else on the page in a view like so
$block = Block::getByID($someBlockID); $bv = new BlockView(); $bv->render($block);
the p-tags become <div style="margin:0"> ?!!?
See pic attached...!
Ermmmmm.....my code actually does make sense and the content is there and wrapped in lovely html EXCEPT the content that got added with TinyMCE
The render method from BlockView() expects as first parameter a block object and as second parameter the optional template name with "view" as default.
Seehttp://www.concrete5.org/community/forums/customizing_c5/how_to_cal...
:-)
The render method from BlockView() expects as first parameter a block object and as second parameter the optional template name with "view" as default.
Seehttp://www.concrete5.org/community/forums/customizing_c5/how_to_cal...
:-)
Oh dear I just found out what was wrong.........actually it's nothing I just looked at two different blocks that were quite similar but had those little differences in the HTML.
Very sorry, false alarm all good with Concrete5 :-D
Very sorry, false alarm all good with Concrete5 :-D
You're right, sorry! I mixed up BlockView::render() with BlockType::render()!
It should read something like this:
But perhaps the blocks you created use a custom template. If so, replace 'view' with 'templates/xxx' where xxx is the filename of the custom template (without ".php").