Let's look at it. In phpBB 2.0, we would just do:
- Code: Select all
$checkbox_enabled = $HTTP_POST_VARS['checkbox'];
In 3.0, we have to do:
- Code: Select all
$checkbox_enabled = (isset($_POST['checkbox'])) ? true : false;
You have to always check existance using isset(), this is also to protect from problems with reigster_globals.
If you've been coding, you may not have gotten any errors when doing it wrongly. Now why is that? phpBB 3.0 hides them by default. There is a "debug" mode that displays them. For modding, you should always enable debug mode. Now how would we go about doing that? Open up config.php, and you should see this at the end:
- Code: Select all
// @define('DEBUG', true);
// @define('DEBUG_EXTRA', true);
Uncomment those two lines like so:
- Code: Select all
@define('DEBUG', true);
@define('DEBUG_EXTRA', true);
Welcome to phpBB dev world!
Now, let's take a look at what those two excactly mean.
DEBUG will add the page generation time and the number of queries to the footer. It will make PHP notices show up. It will also disable the "install exists" message.
DEBUG_EXTRA will add the memory usage of the current page load to the footer. It will also allow you to analyse the SQL by adding ?explain=1 to the url bar. DEBUG_EXTRA will only work if DEBUG is enabled.
There you go, you now know how to use phpBB's debug mode