doumu1951 2010-04-30 10:41
浏览 39

PHP MVC上的HTML输出上的额外空格

I'm getting extra whitespace, that is not CSS, or nothing like it on the view output: The HTML.

I've checked for ?> (removed, where I could), saved UTF8 without BOM. Checked for existent white space in the beginning of each file, even at end.

This is the structure:

index.php - this is the entry point;
MODEL/
CONTROLLER/
VIEW/

Let's say, that trough method GET, its sent the var TPL with some value. Let's call it LIST, so it pulls the LIST model, with all data and then show the right template to the user, with the right data.

I used and tested, with require_once, include_once, include, even tested with readfile (just to test). The LIST Template opens the header.tpl and footer.tpl; I also tryed to remove this both includes from LIST template, but still, the extra white space continued.

This is where the extra white space is coming from. This controller is placed between <body> controller activity runs here </body>, this is where the extra white space is coming from:

$model_works->getRows();

$rows = $model_works->rows;

if ( !require_once('views/list_works.tpl.php') ) {

echo "<p>Error.</p>";

} // end if clause

The list_works.tpl.php, is basicly HTML with tags; I've t tested by changing the extension to something else, like html.

Also, just to remember that at top of this file, we are using require_once to open the header.tpl and at bottom the footer.tpl. I've tested by removing both and the extra white space was still generated.

The extra white space is being generated here:

<body>
# EXTRA WHITE SPACE HERE #
<!-- some stuff working fine -->
</body>  

Thanks a lot for looking, ;D

  • 写回答

3条回答 默认 最新

  • douou1872 2010-04-30 10:55
    关注

    An additional line-break in one of your files, a stray echo, keep commenting stuff out till you find it ?

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)