PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 16, 2022

[FIXED] PhpStorm: write in PHP, HTML and JS in ctp file

 March 16, 2022     cakephp, html, javascript, php, phpstorm     No comments   

Issue

Using CakePHP to write code, usually *.ctp files contains PHP, HTML and JavaScript code. Unfortunately PhpStorm recognize PHP and HTML only:

PhpStorm example

Of course if I edit a JavaScript-only file (.js) the highlight and autocompletion work.

I tried to follow this answer, but I cannot assign the same extension to multiple languages.

How to edit all the three languages in PhpStorm?


Solution

Do the following:

<?php $this->append('script');?>
<script type="text/javascript">

jQuery(document).ready(function() {
    ...
});

</script>
<?php $this->end();?>


Answered By - mark
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing