[support] Eclipse PDT, xDebug and Drupal .tpl.php files

Moses Elias (2) iom at netvision.net.il
Tue Jun 8 20:06:37 UTC 2010


Hi Anthony,

Your advice was spot on. I had mapped a path incorrectly because I had 
hard-coded a URL link in template.php and the URL in Eclipse that was 
being called was being redirected to the wrong location. The print_r 
advice led me to right conclusion.

Second, in Eclipse the externally configured Firefox browser wasn't 
interacting with the debugger as expected because I opened and shutdown 
the browser at the end of each debugging session. Now that I've stopped 
shutting down the browser after each debugging cycle (and left the 
browser window open) that problem has gone away too.

Third, according to Chris Charlon you can debug any arbitrary URL and 
you don't have to always start your debug session from index.php. 
However I haven't had the time to check it out yet. Chris says:

 >> You can debug a single URL, you must change the project settings 
(right-click > properties). You can save multiple "web servers" >> in a 
project, so you can have one for index.php and one for any other URL 
you're concentrating on.

 >> When debugging a template you must visit a node to see it in action, 
usually.

Lastly, and here's another question. I am also wondering why Step 
Filters in Eclipse PDT don't seem to work. From what I have read so far 
it hasn't been implemented thus far, but I just wanted to confirm this 
myself because it would be a great effort saver if Step Filters were 
implemented as expected, and you exclude certain source directories, 
while you're debugging.

Thanks for your help.

Moses


On 02/06/2010 11:37, Anth wrote:
> Hi Moses,
>
> If you're getting your debugger to stop at all then most of your setup
> must be fine.  Are you sure that your node-product.tpl.php is being
> called?  Maybe throw a print_r or something in it to make sure.  I know
> that I have seen bugs around node template suggestions not being used
> unless node.tpl.php is in the same file.  If the only command is
> terminate then all server side processing is done usually.  Is the page
> rendering?
>
> You won't see anything in the browser until Drupal has finished
> processing everything, this is mainly because all the work goes into
> building up an output string and the last thing that index.php does is
> basically just write that string out.  At this point control goes back
> to the browser until something (a page navigate or a submit) sends
> control back to the server and it all goes through it again.  It will
> only then stop if where you're sending it to has a breakpoint set up.
>
> I'm pretty sure it has to be a php file, but don't quote me on that.  I
> think I once tried to get it to launch to a html file for a non Drupal
> project but didn't have much luck.  The main reason it's index.php that
> needs to be called is that index.php does a call to drupal_bootstrap so
> that all it's variables and database access is set up so calling to
> another file wouldn't really work.
>
> HTH.
> Anthony.
>
> On 6:59 AM, Moses Elias (2) wrote:
>    
>> I am an Eclipse PDT newbie, so apologies if my questions are basic.
>>
>> THE ENVIRONMENT
>> ================
>> I have set up Eclipse PDT 2.1.3 with xDebug and I am trying to debug a
>> Drupal application with LAMPP on Ubuntu via my localhost. I have
>> installed the Drupal Plugin for Eclipse.
>>
>> I have set breakpoints in page-front.tpl.php and page.tpl.php and the
>> debugger stops in the files where expected.
>>
>>
>> THE PROBLEM
>> ============
>> However, I have set a breakpoint in a node-product.tpl.php file
>> (derived from node.tpl.php) but when I click Run>  Resume and I
>> navigate to the correct page in the browser window, the debugger just
>> refuses to stop execution in it. At this point under Run, the only
>> command highlighted is Terminate, so I don't know where in the
>> application I am at present.
>>
>> If the application is still executing, how do I break out of the loop
>> and get back control so I can start debugging?
>>
>> Secondly, I am not certain why I am not able to get into that file and
>> perhaps there's a good reason I am not aware of. This is my primary
>> aim here.
>>
>> Also, my Firefox External browser opens when I initiate a debug
>> session, but there doesn't seem to be a relationship between Run>
>> Step Over (F6) and what I see in the browser window. The browser is
>> expecting user input. How do I coordinate between the browser and the
>> Eclipse IDE so it's interactive between the two? An action in one
>> makes it pause or continue in the other. That means, when I click in
>> browser window, it should show me where I am in the debugger.
>>
>> I have one more question. When I start a Drupal debugging session most
>> people set up the Run>  Run Configurations to start at index.php. My
>> question is can I start a debug session at some arbitrary URL address
>> or does it always have to begin with a .php file? How about a .tpl.php
>> file located not in the htdocs folder, but in the theme folder itself?
>> Should it be a .tpl.php file, or can it be a URL address?
>>
>> I know these are basic questions, but any leads would be appreciated.
>>
>>
>>
>>      



More information about the support mailing list