How to open moodle code as a project to implement break points

How to open moodle code as a project to implement break points

by Nadirshah Ferozepurwalla -
Number of replies: 6

How to open moodle code as a project to implement break points and trace the program execution, like we can do with .net websites using visual studio.

How to do this for a moodle/php website project?


I need this as it is near to impossible to find where the code for a particular item or page elements is located,

I am not able to find where a particular function is defined! 


e.g I want to edit the portion which is responsible for displaying "You are logged in as"admin logout. I found the line using the css class to trace the div, and there a function call  $OUTPUT--> loginsomething is responsible for displaying the "you are....", now I have searched every where, using Dreamweaver, using windows folders and contents search, manually but I CANNOT FIND WHERE the function loginsomething() is defined!!!

I tried to find where "echo $OUTPUT->login_info(); " logininfo is defined but no luck


Any advice and help will be appreciated

Average of ratings: -
In reply to Nadirshah Ferozepurwalla

Re: How to open moodle code as a project to implement break points

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Try NetBeans

Average of ratings: Useful (1)
In reply to Nadirshah Ferozepurwalla

Re: How to open moodle code as a project to implement break points

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Took me less than 90s to find using a simple 'Find in Files' in Geany - a fairly basic text editor (only took that long because my first search was for login_info() and of course I should have just searched for login_info as the function itself does not have empty brackets! smile ). Similarly a grep string search would do it as would many other tools (including Marcus' suggestion of Netbeans).

Choosing the right tools to achieve something can mean looking at the simple ones, not just looking for the complex solutions, such as adding multiple breakpoints to try and work out where the code is going. Simple text searches will find you lots of the code if you already know what you are looking for as in this case.

That said, if you need breakpoints and the like, then Moodle is primarily html, php, css and javascript and can all be read/developed using an IDE like Netbeans, or a simple text editor like Vi (OK - no Linux users need to start on my use of the word 'simple' for Vi :D ) or notepad++, Geany, etc.



FYI - lib/putputrenderers.php - from line 698, but I haven't upgraded from 3.0 beta or RC to the finished published version yet so the line number may be different.

Average of ratings: Useful (1)
In reply to Richard Oelmann

Re: How to open moodle code as a project to implement break points

by Nadirshah Ferozepurwalla -

geany and notepad++

find in files option great help thankyou

In reply to Nadirshah Ferozepurwalla

Re: How to open moodle code as a project to implement break points

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In reply to Gareth J Barnard

Re: How to open moodle code as a project to implement break points

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

XDEBUG is a way of getting NetBeans to debug php. However in Netbeans it doesn't do conditional breakpoints. I believe it does when used with Eclipse. When trying to get it to work in either it is important to know which php.ini file your system is using, which can be worked out by running a page with a call to phpinfo(). Don't make that available to the public however (information leak and so a potential security loophole)

In reply to Nadirshah Ferozepurwalla

Re: How to open moodle code as a project to implement break points

by Bob Puffer -

Netbeans, Eclipse (not the Zend version). Both have their issues but kinda work most of the time. PHPStorm is said to be quite good but I've not been able to get it up and running after two thirty-day trials.