[Solved] Require file causing stray one

I am including some content in a layout:

    <?php echo require APP .  'Template/Layout/mytest' . '.ctp'; ?>

The content is displayed, but causing a stray 1 (one) right after the content.
No stray 1 anywhere if I delete that line. Here is the content, just a test now:

<div> Jimmie it worked</div>

A couple of things

  • You should elements
  • In the event that you’re not using CakePHP, you only use require, since echo is treating require as an argument (and show “1” every time you use it
  • a simple shorthand to echo things is <?= "a" ?>
1 Like

OK i missed that it goes in Element, I figured Layout, all working, thanks. I guess each framework has their own little thing.

<?php echo $this->element('mytest'); ?>

works, thanks so much.