Is there a bug in the Content block, or am I missing something?

Permalink
Okay, so I've noticed this in the past on other sites I've built, but now it's just bugging me too much to leave it be. Can someone please tell me if this is a bug in the Content block, or if I am just totally missing something?

I created a custom template for the Content block. It's pretty simple ... I just wrap the standard code in a named DIV so I can apply custom styles to it:

<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<div class="content-box">
   <?php 
      $content = $controller->getContent();
      echo $content;
   ?>
</div>


If I add this to the page, there is about a line break of space above my DIV. Above the DIV, and below the outline for editing the block, so I know its in the block.

If I add an HTML block with the same ... a DIV with the same class, and the same content on the inside, it adds to the page just fine. No weird line break.

If I open this up in my debugger to try and figure out what's going on, it literally shows a blank line in the DOM tree.

Is the Content block producing some kind of weird character that's causing a line break in the browser, and a blank line in the debugger, or am I totally missing something?

The CSS style in both cases, Content block versus HTML block, is the same, obviously.

THANK YOU!

(Oh, and I've tried it without the "defined" line ... it doesn't make a difference)

elyon
 
okhayat replied on at Permalink Reply
okhayat
Tested on a local installation and I really can't see where the problem is. it just displays fine using your template.
A screenshot may help with a code snippet from the output and related CSS.
Is this happening on all browsers?
elyon replied on at Permalink Reply
elyon
The code snippet I am using is above. It works fine if I place the equivalent code within a PHP block, but it creates the mysterious blank line when I put this code inside a custom template.

Call it irony, but I just received a comment today from a user who is experiencing this same issue with the Flash Video block. The same symptoms of a blank line and an empty space in the debugger is occuring there as well.

I am using Opera, and they are using Firefox, so that's two browsers. If you like, you can check out their screenshot they posted on the other thread. It helps illustrate the same problem I'm having here with the Content block

http://www.concrete5.org/marketplace/addons/flash-video/support-and...
elyon replied on at Permalink Reply
elyon
Okay, we figured out the problem.

The byte order mark is part of the Unicode standard, and is most important for UTF-16. PHP doesn't support it, and renders it as a line break in the HTML.

The line break was created because my template file was encoded in UTF-8 with a BOM. I've set my code editor to default to encode without it.
okhayat replied on at Permalink Reply
okhayat
Heh.. since I stopped using Winblows I didn't have this issue! ;)
elyon replied on at Permalink Reply
elyon
This isn't really a Windows issue. In fact, Unix programs are some of the worst offenders for not supporting the BOM, which is Unicode standard ;)
szucslaszlo replied on at Permalink Reply
Hey guys! Thanks for the answers! The project was cancelled and I totally forgot to check back to the forums. The encoding could have been the cause of this indeed, because I faced this problem before, and it sometimes recurred and vanished 'randomly'.