-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comment out HTML and PHP together #18244
Comments
Hi @atiquz. So, what should happen? Should the PHP not evaluate? That means we'll send PHP code over the wire, which is likely not a good idea. |
If you don't want to execute the PHP code and don't need the HTML output at all (i.e. it doesn't even have to be there for somebody looking at the HTML source), you can do it like this instead. <?php /*<span class="stamp stamp-md <?=$item['class'];?> text-white mr-3">*/ ?> |
@thomascorthals Thanks! Yes, I usually comment out sections of HTML + PHP like this: <?php /*<span class="stamp stamp-md <?=$item['class'];?> text-white mr-3">*/ ?> While this works, it feels verbose and a bit hacky, especially when working with mixed PHP/HTML template code (e.g., in ✨ Proposal: Unified PHP + HTML Comment SyntaxOption 1: PHP-native comment block<?# <span class="stamp stamp-md <?=$item['class'];?> text-white mr-3"> #?>
This would work inside PHP mode ( Option 2: HTML-style hybrid comment block<!--# <span class="stamp stamp-md <?=$item['class'];?> text-white mr-3"> #-->
This version could be processed by PHP (if supported in future versions) to skip output and skip executing embedded PHP inside the block. That would make it both safe and super developer-friendly. ✅ Advantages (for either syntax):
Would love to hear your and others' thoughts. Do you think introducing a new HTML+PHP-safe comment syntax like |
For single lines, I don't think https://sourcegraph.com/search?q=context:global+%3C%21--%23&patternType=keyword&sm=0 |
I agree that it must start with |
Description
here you could see html is commented but not PHP so it is highly requested to create a new feature that will comment out HTML and PHP together.
The text was updated successfully, but these errors were encountered: