Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pdt-dev] Javascript syntax highlighting in mixed PHP/HTML files

On 9/1/21 11:56 AM, Basil Mohamed Gohar via pdt-dev wrote:

Does PDT currently support highlighting Javascript code that is part of a mixed HTML/PHP file?  For example, this screenshot demonstrates what I'm missing:

The code is also included here as an example:

     <script src="Beoro/js/pages/beoro_ajax_content.js"></script>
     <script type="text/javascript">
             var USER_TYPE = "<?php echo $UserLevel; ?>";
             function LoadData(byTeacher){
                 jQuery("#imgLoading").css("display", "inline");
                 var grade     = jQuery("#selGrade option:selected").val();
                 var section = jQuery("#selSection option:selected").val();
                 var dateVal = jQuery("#tbDateDisplay").val();
                 var period     = jQuery("#selPeriod option:selected").val();
                 var teacher = jQuery("#selTeacher option:selected").val();


This file is named "PeriodAttendance.php", and it contains a mix of PHP, HTML, and Javascript code.  The PHP and HTML code are correctly highlighted, but the Javascript code enclosed in HTML <script> tags are not recognized.

Is there a way to get this working, is this not supported, or am I missing something that would tie all of this together?

This would be an amazingly useful feature for working in modern web development and frameworks, as such files tend to include these kinds of mixed content.

Thanks!

Sincerely,

Basil

I installed "Eclipse Web Developer Tools 3.22" from the Eclipse Marketplace, and after a restart, my Javascript-in-PHP files is properly syntax highlighted.  So, I think that is the solution to the problem I raised, at least for now.  I'm not sure if I can have a richer experience with code-completion and jump-to-declaration, but at least now the files are a lot easier to read.  Hopefully this can help others that are experiencing the same issue.


Back to the top