pageStart Portal issue

I noticed that if there is more than one component using

@portal(pageStart, includeOnce: true)

that a newline character is sometimes (not always) being added at the end of each one. This looks neater in the page source but is breaking the HTTP header which may stop sessions and cookies working.

I have been careful to ensure I place the opening PHP tag immediately after the @portal and the closing PHP tag before the @endportal. It seems that Elements is sometimes (not always) adding the new line between one components closing tag and the next components opening tag.

<?php
code here
?> // Newline seems to be added here
<?php
code here
?>

I’ll add a ticket to investigate this, but if you could provide a full code example with expected output, that’d be a big help :folded_hands:

I made some more tests and found a pattern. If I have two or more components that use

@portal(pageStart, includeOnce: true)

with includeOnce set to true then I see the new line after the component. If I change the includeOnce on one of the components to false then the new line disappears. I hope that provdes a clue!

A connected issue happens in the ‘Edit Extra Code’ dialog for the page. If I type a single line of code in the Page Start section like this

then that seems to have a newline at the end of it when the page is published.

I’ve ticketed this one for us to investigate :slight_smile: