Skip to content

Changing file extension to .php doesn't seem to support PHP tags #11575

Open
@JohnnyWalkerDigital

Description

@JohnnyWalkerDigital

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:

<?php
  if (!isset($_GET["new"])) {
?>

is in the HTML output as

<!--?php
  if (!isset($_GET["new"])) {
?-->

How to reproduce

  1. Change file extension of a view from .antlers.html to .antlers.php
  2. Add <?php ?> tags to the beginning of the file
  3. Preview the output in your browser

Logs

Environment

Environment
Application Name: PRIVATE
Laravel Version: 11.44.2
PHP Version: 8.4.3
Composer Version: 2.8.6
Environment: local
Debug Mode: ENABLED
URL: www.private.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single, slack
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.50.0 PRO

Statamic Addons
statamic/eloquent-driver: 4.20.2
statamic/ssg: 3.1.1
stillat/antlers-layouts: 2.1.0
visuellverstehen/statamic-classify: 3.0.0

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: file
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions