You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the documentation, if you change your view's file extension from .antlers.html to .antlers.php you can write all the raw PHP you want using native PHP tags. However I tried this with a view and the PHP tags within the document are rendered as HTML.
For example:
<?php
if (!isset($_GET["new"])) {
?>
is in the HTML output as
<!--?php
if (!isset($_GET["new"])) {
?-->
How to reproduce
Change file extension of a view from .antlers.html to .antlers.php
Hmm, your code is working fine for me (provided I add a closing <?php } ?> somewhere). How are you using the .antlers.php file - as a layout/template/partial?
While you can use raw PHP in Antlers templates like that, for something simple like checking a GET parameter, I'd use Statamic's get variable instead:
Since I'm unable to reproduce your issue, and I haven't heard back in a while, I'm going to close this issue for now. You can use the get variable to access query parameters in your templates.
If you're still running into issue with PHP in Antlers, please let us know how you're using the Antlers view (eg. as a layout/template/partial), and we can take another look.
Uh oh!
There was an error while loading. Please reload this page.
Bug description
v5.50.0
According to the documentation, if you change your view's file extension from
.antlers.html
to.antlers.php
you can write all the raw PHP you want using native PHP tags. However I tried this with a view and the PHP tags within the document are rendered as HTML.For example:
is in the HTML output as
How to reproduce
.antlers.html
to.antlers.php
<?php
?>
tags to the beginning of the fileLogs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: