Patcouch22
Patcouch22

Reputation: 912

PHP Code not Recognized in CTP file

php script is not recognized with script tags, if I use then the code runs just fine.

Works:

<?php $layout->sessionFlash(); ?>

Doesn't Work:

<?$layout->sessionFlash();?>

Works:

<?php echo $content_for_layout; ?>

Doesn't Work:

<?=$content_for_layout;?>

This is code taken from another website that works correctly on the server but I am trying to get it working on my local wamp server and I am running into this issue. It is only in the .ctp files.

Upvotes: 1

Views: 780

Answers (1)

Pit
Pit

Reputation: 4046

Like Babiker already said, short_open_tag has to be set to 1 in your php.ini. But to be on the safe side, you should only use long tags and echo in your code, as you cannot be sure if the PHP server you might your application deploy to has short tags enabled.

Upvotes: 7

Related Questions