phpfmt_stable
phpfmt_stable copied to clipboard
Disable on html block ?
how to disable this plugin on html block ?
it becomes very messy when this automatically formatting php on html block
Thanks
Is bad practice merge Html code with PHP; you look like need to store your "foreach loop" in a variable in top of php file and short print the variable in html code, instead of create and php block code...
https://phptherightway.com/#templating
I recommend that you go for a structure:
Simple example of a plain PHP template Using the Plates library.
<?php // user_profile.php ?>
<?php $this->insert('header', ['title' => 'User Profile']) ?>
<h1>User Profile</h1>
<p>Hello, <?=$this->escape($name)?></p>
<?php $this->insert('footer') ?>
Example of plain PHP templates using inheritance Using the Plates library.
<?php // template.php ?>
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<main>
<?=$this->section('content')?>
</main>
</body>
</html>
<?php // user_profile.php ?>
<?php $this->layout('template', ['title' => 'User Profile']) ?>
<h1>User Profile</h1>
<p>Hello, <?=$this->escape($name)?></p>
and don't expect editor / plugin to behave due to personal development, even outside of framework ... implements MVC at least
Thank you for your detailed explanation. I think in some cases it is fine to add the PHP code on the view. I hope the contributor can consider implementing this.