Syntax Stack and PHP

Hi,
When I enter PHP code in Syntax - it will not be displayed as code - the code will be executed. What do I have to do to show my PHP code?

The Syntax stack is for displaying code not executing it and so should do exactly what you want. Have you tried using it?

That’s why I post here my issue. I tried it in Rapidweaver - put the Syntax stack into a site, preview the site in Rapidweaver, Chrome and Safari - but the PHP Code will be executed.
I have tried HTML and PHP code. HTML will be displayed as code but PHP will be executed.

I’ve only used the Syntax stack for CSS code and it works perfectly fine. I just tried with some simple PHP and there’s definitely a problem: it does not display the code.

For example, try:

<?php
echo "Hello World!";
?> 

And you’ll simply see Hello World, but not the full code as shown above.

1 Like

That’s exactly what I did.

Ah ok. There must be a problem. I’ve not got access to RW currently so didn’t try it.

I’m sure Adam will help you out on Monday.

If this is a very pressing situation, then a temporary compromise is to use a Markdown stack. Start off with three backticks. Insert code. Then on last line add 3 more backticks. Will show up fine (but without some of the cool styling options the Syntax stack provides).

Oh it is not urgent - I thought I did something wrong. I can wait until next week:slight_smile:

Thanks for your tip - but indeed I will have this cool styling options

Thanks a lot

Hi there @qiwi – I am not seeing this problem here. I added a Syntax stack to the page, and even pasted in @mitchellm’s example PHP, so we’re all on the same page, and it works just as expected here:

If you wish to post a ZIP file containing your project file, and point me to the page and section in question I will have a look. If I get time today I can take a look, but it might not be until Monday.

@qiwi sent me his project file. The reason the PHP is being rendered is that the page is a PHP page. You don’t have anything on that page though that needs PHP, so make your page a plain HTML page instead.

Ok - so Syntax is not able to stop PHP. I sent you a testpage. On the full page I need PHP - why else should I rename the page from .html to .php

Thanks

Yes, you did. That is why I said this above:

If you have a need to process PHP on the page, then you will have to retain the PHP extension for your file name and cannot rename it to an HTML extension. You just will not be able to show PHP within the Syntax stack on that page as it will get processed when the PHP is parsed on the page.