This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 219542

Summary: Request: HTML5 integration in PHP Projects
Product: php Reporter: MrJxN
Component: ProjectAssignee: Tomas Mysik <tmysik>
Status: VERIFIED FIXED    
Severity: normal CC: augcampos, dkonecny, kganfield, mentlicher, mikerowe81, mmirilovic, obrejla, pjiricka, vriha, xwisdom
Priority: P2    
Version: 7.3   
Hardware: All   
OS: All   
See Also: http://netbeans.org/bugzilla/show_bug.cgi?id=222236
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 226256, 226389, 226846    
Bug Blocks:    
Attachments: proposed patch
sample project with Smarty framework

Description MrJxN 2012-10-04 18:00:23 UTC
Currently, no default way to add PHP files or PHP web pages to the new HTML5 project type.  Currently must add "empty file" and add .php extension.  Best case scenario (wish) - new combined project type: "HTML5/JS/PHP Project".

Also, PHP web pages partially work with the NetBeans IDE Support Plugin - CSS Styles update accordingly when items are selected in Chrome (Chrome Plugin's select mode on), and Chrome updates automatically on file save, but there is no communication either way between Navigator window and Chrome.
Comment 1 Ondrej Brejla 2012-10-05 06:43:53 UTC
More project part, isn't it? And probably HTML5 component? Not sure...
Comment 2 Tomas Mysik 2012-10-05 07:11:45 UTC
Well, this is definitely planned for PHP projects but currently only static files (HTML, JS, CSS) are supported.
Comment 3 mikerowe81 2012-10-17 03:30:29 UTC
(In reply to comment #2)
> Well, this is definitely planned for PHP projects but currently only static
> files (HTML, JS, CSS) are supported.

That's great to hear Tomas. I was very excited to see the Chrome integration but was disappointed when I couldn't use it in my PHP projects, several of which are essentially HTML5 Apps. I have tried a couple other Chrome extensions that tried to do similar things as far as updating the browser when it detected a change to a file and one that allowed editing CSS directly in the Chrome Inspector and then would update the CSS file, but usually it seemed kind of clunky.

I think it would be nice with the PHP files to at least provide an opportunity to automatically refresh the browser page on save.

Thanks for continuing to advance Netbeans!
Comment 4 Tomas Mysik 2012-10-17 08:33:01 UTC
It would be nice to have it in the next version of NetBeans.
Comment 5 augcampos 2012-10-29 14:23:42 UTC
I'm waiting for the javascript debugger in php projects too...
Comment 6 xwisdom 2012-10-30 04:38:06 UTC
I was just about to log a similar request when I saw this one.

I really like the new HTML5 project features but I would really like to see them added to the PHP Project as well. 

We really need these great HTML5 debugging features in our PHP projects. 

Please try and add this in Netbeans 7.3

Keep up the good work
Comment 7 Tomas Mysik 2012-11-28 12:46:27 UTC
Created attachment 128507 [details]
proposed patch
Comment 8 revisionzero 2012-12-03 07:17:17 UTC
Have you guys also considered to include a drop down with a list of browsers to preview with for PHP projects? It's a feature that's currently only available in HTML5 projects as well.
Comment 9 Ondrej Brejla 2012-12-19 15:59:12 UTC
*** Bug 156323 has been marked as a duplicate of this bug. ***
Comment 10 mcfedr 2013-01-31 09:26:56 UTC
I would really like to see the new html5 project features merged with the php project features - it makes no sense to have them so separate.

I think the key feature is that it should be possible to debug both javascript and php at the same time, using the same "built-in" or external web server.
Comment 11 Tomas Mysik 2013-02-07 07:39:53 UTC
(In reply to comment #10)
> I think the key feature is that it should be possible to debug both javascript
> and php at the same time, using the same "built-in" or external web server.

I tried it with the patch and it works for me but - the PHP debugger cannot be ended via the button in the main toolbar, I had to cancel it in the status bar (the progress). So adding Ondra and Martin to CC, not sure where the problem could be and what needs to be done. Please let me know if I should file a bug once I push my changes to trunk.

Exact steps:
- have a PHP project
- put breakpoint in a PHP file as well as in a JS file
- debug application [1]
- NB stops on PHP breakpoint -> continue
- NB stops on JS breakpoint -> continue

-> now, there is no standard way (via main toolbar) to stop the PHP debugger.

Thanks.
[1] Not sure if it makes any difference - I am "attaching" PHP debugger, it means that the browser is not run once I click the Debug Project icon.
Comment 12 Ondrej Brejla 2013-02-07 08:15:03 UTC
Sorry, but I really don't understand the lifecycle of 2 participating debuggers and I think that I don't want to. Probably Martin will know what to do :)
Comment 13 David Konecny 2013-02-07 18:55:19 UTC
(In reply to comment #11)
> -> now, there is no standard way (via main toolbar) to stop the PHP debugger.

You have two debugging sessions running and buttons in toolbar correspond to your *active* debugging session. And because of JS breakpoint was hit the active session is currently the "JS" one. Hence disabled stop button. Open view from debugging section named like "sessions" and have a look there - if you active "PHP" debugging session the stop button will be available again.
Comment 14 Tomas Mysik 2013-02-08 06:25:59 UTC
Thanks Davide, I will try it. Still, seems to me to be a bit usability issue.
Comment 15 Tomas Mysik 2013-02-08 06:34:52 UTC
Fixed, a combo with browsers added to the Project Properties dialog.

http://hg.netbeans.org/web-main/rev/0b854bf6d86d
http://hg.netbeans.org/web-main/rev/65c3c1f9e35c
Comment 16 Tomas Mysik 2013-02-08 07:11:13 UTC
Please notice that the default preselected browser is the external one with NetBeans integration.

Thanks.

http://hg.netbeans.org/web-main/rev/8b391821da00
Comment 17 Tomas Mysik 2013-02-08 12:50:17 UTC
BTW I just added "reload browser on save" functionality - enabled only for browsers with NB integration. Maybe we could/should add checkbox for it? Not sure, waiting for the feedback from our users...

Thanks.
http://hg.netbeans.org/web-main/rev/643a4da91960
Comment 18 Tomas Mysik 2013-02-08 12:52:00 UTC
(In reply to comment #3)
> I think it would be nice with the PHP files to at least provide an opportunity
> to automatically refresh the browser page on save.

This should now work, see my last comment.

Thanks.
Comment 19 Quality Engineering 2013-02-09 01:43:52 UTC
Integrated into 'main-golden', will be available in build *201302082300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0b854bf6d86d
User: Tomas Mysik <tmysik@netbeans.org>
Log: #219542 - Request: HTML5 integration in PHP Projects
Comment 20 neufena 2013-02-21 16:22:57 UTC
shame this hasn't made it into the 7.3 release, will there be an incremental update with this patch or is it going to have to wait till 7.4?
Comment 21 Vladimir Riha 2013-03-01 16:08:56 UTC
I got OutOfMemory when using inspection together with upload on save after quite intense changing font-size property (I admit I just wanted to see how it behaves in such case), please look at issue 226901. I'm not sure if this should be somehow resolved together with this enhancement
Comment 22 Vladimir Riha 2013-03-11 08:32:45 UTC
Carefully verifying. I tried combination of PHP & JS debuggers and inspection features and it seems generally fine (apart from missing new "DOM" HTML Navigator and Document|Selection switcher in CSS Styles window for PHP files).

Issue 226901 is rather fabricated use case so I think it may not be a blocker for this.
Comment 23 Petr Jiricka 2013-03-11 21:24:03 UTC
> Carefully verifying.

So can this enhancement be used in isolation without fix for bug 226383, or is that one required too?
Comment 24 Vladimir Riha 2013-03-11 23:42:12 UTC
I guess that at least Honza's changeset [1] or its "part" will be necessary (or at least "text/x-php5" - perhaps "text/x-jsp" should be omitted?). I don't know about [2] if it's used by PHP?


[1] http://hg.netbeans.org/web-main/rev/eedff2058f80
[2] http://hg.netbeans.org/web-main/rev/6e18240fcf97
Comment 25 Vladimir Riha 2013-03-12 09:36:20 UTC
Just for the record, JS debugger works in JS file linked to PHP via <script>, so for instance this works:

index.php

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
       include 'aa.php';
        ?>
    </body></html>


aa.php:
<script src="linebp.js"></script>




While JS generated by PHP or embedded in aa.php will stop on incorrect line (in case for instance XHR breakpoint) or not at all in case of line breakpoint. But this imho is kind of expected (just like you cannot create line breakpoints in tpl or twig files)

As for templates, let's say I have Smarty tpl file somewhere and it contains  something like

<script type="text/javascript" src="scripts/aa.js"></script>

and this file is being displayed ("generated") in index.php which is in different folder. Now line breakpoints are hit in aa.js (sometimes file is opened read-only but I have no idea why and it seems random). I'm attaching simple project to test it.
Comment 26 Vladimir Riha 2013-03-12 09:41:27 UTC
Created attachment 132502 [details]
sample project with Smarty framework
Comment 27 David Konecny 2013-03-12 19:31:37 UTC
(In reply to comment #25)
> [...] Now line breakpoints are hit in aa.js (sometimes file is
> opened read-only but I have no idea why and it seems random).

Readonly JS file indicates that JS Debugger did not find project source file for server JS file URL and instead of opening project source debugger treats the file as remote JS file. Hence the file is readonly and was downloaded into IDE's userdir. If it happens randomly and sometimes it works and other times not then file an issue for js debugger/MartinE. Thx.
Comment 28 Marian Mirilovic 2013-03-18 12:48:31 UTC
This is NetBeans 7.3 Patch 1 candidate, we handled it this way for long time and it met all the criteria for integration according to any possible processes we are having and following.
Comment 29 John Jullion-ceccarelli 2013-03-20 17:25:39 UTC
Users are requesting full Easel functionality in projects that use server-side templating. The fix in this issue, as far as I understand, only allows you to set Chrome with NetBeans Integration as the target and thereby enable Easel styling of HTML pages - not PHP pages or fragments - and debugging of JavaScript and PHP. So we feel this isn't going to match people's expectations and that rather than introduce incomplete functionality in a path release we want to think the workflow through for server-side templating and include a full solution in the next release. Thus removing 73patch1-candidate keyword.