phpfmt_stable icon indicating copy to clipboard operation
phpfmt_stable copied to clipboard

Disable on html block ?

Open navotera opened this issue 7 years ago • 2 comments

how to disable this plugin on html block ? it becomes very messy when this automatically formatting php on html block image Thanks

navotera avatar Nov 16 '18 11:11 navotera

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

wnunezc avatar May 21 '20 16:05 wnunezc

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.

navotera avatar Aug 01 '20 07:08 navotera