Hi,
I submitted the reply below to your PM but it is sitting in my Outbox and I don't know if it has been sent. So I've posted a copy here just in case there is anything that someone else might be interested in.
Quote: |
May I know how would I do in phped if say, if don't want to start from index.php to all the way til end. but say i just want to debug
http://localhost/magento/customer/account/login
How shall I command phped to directly start debugging from above link in my magento. |
Magento uses a lot of 'rewrites' to redirect URL's to various parts of code. If you have not debugged Magento before, it can actually be quite complex working out which PHP files are used.
Magento uses the Zend framework, so learning about that can be beneficial.
Magento uses XML files to tell it how to do various things. For th URL
http://mysite/customer/account/???? the XML file that is used is called
app/code/core/Mage/Customer/etc/config.xml and in that file you will see a
router entry, which then handles the customer part of the URL (that is the 'rewrite' bit).
Do not get confused by the word
customer being present in the URL, XML file path and the final PHP file. That is not what Magento uses for the rewrite; It is the XML file that specifies the URL path.
The login process then goes through
app/code/core/Mage/Customer/controllers/AccountController.php
In there you will see loginAction(), logoutAction() and a few others.
You can force PhpED to break in that code by either setting a breakpoint (recommended) or adding a DebugBreak() command (sometimes more convenient, particularly if you want to wrap the DebugBreak with a condition):
/**
* Customer login form page
*/
public function loginAction()
{
DebugBreak(); // REMOVE THIS WHEN FINISHED DEBUGGING
if ($this->_getSession()->isLoggedIn()) {
$this->_redirect('*/*/');
return;
}
$this->getResponse()->setHeader('Login-Required', 'true');
$this->loadLayout();
$this->_initLayoutMessages('customer/session');
$this->_initLayoutMessages('catalog/session');
$this->renderLayout();
} |
If you do use DebugBreak() remember to remove it before publishing your code.
PhpED is actually very good for debugging Magento. I think it is much better than Xdebug or Zend debugger. A lot of Magento developers use PhpED. However, for Magento specific questions I recommend using the Magento forums at
http://www.magentocommerce.com/boards/