1

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.

2
  • 1
    You have short tags disabled? Commented Jun 18, 2011 at 17:47
  • 1
    short open tags needed to be turned on through the wamp icon. changing it int he php.ini file did not work. I had to left click on the wamp icon > 'PHP' > 'PHP Settings' > click 'short open tags'. Wamp will then reset and it should be checked. Commented Jun 18, 2011 at 17:53

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.