PHP/Drupal Gotchas?
I'm starting to switch from ASP.NET to PHP, and also Drupal.
In ASP.NET, if the user has Cookies or Javascript turned off, this can introduce a lot of unforseen problems and complications. Most users have the default settings (on,on) but 开发者_运维问答when they don't, mud hits the fans and it can be confusing as to where the "bug" is.
What other kinds of gotcha's are there for PHP and Drupal? Will there be problems if Javascript, Cookies are turned off? Other things to look out for?
- Don't delete the user with id 0, that is the anonymous user. It'll give you a lot of strange bugs all over the place.
- Drupal will cache pages for anonymous users. This can sometimes give a few problems if you want to run some code when users visit a certain page etc, as they will just get a cached version and you function wont run. This is, however, a huge performance gain.
- Drupal does OOP using "hooks", so naming your functions correctly can make the difference between failure and success.
- Drupal caches a lot of info for the menus and the theming system. If you start to get frustrated because, your style or markup changes don't come into effect, try to clear the cache.
- Get familiar with drush it will save you a lot of time, when working on a site.
I'm sure there are many more, but this is some of the top ones I've run into over the time.
As with many login systems, users cannot log into Drupal with cookies disabled. See this thread for a bit more info: http://drupal.org/node/137678
Drupal should work fine with JS disabled, however.
I can't think of any other gotchas.
If you encounter the "White Screen of Death", go here http://drupal.org/node/158043 for help. There are a few lines of code to add to your index.php file to turn on error reporting (often revealing a fatal error).
Make sure your PHP memory limits are set high enough to run Drupal and any modules you install.
There are so many! :P
Anyway, PHP doesn't rely on Javascript so you're safe there.
Regarding cookies, they are needed to store the SESSION ID but if they aren't active the SESSION ID can be propagated through the URL (I think ASP.NET does this too - inside ()
).
I would start reading these high voted PHP questions, from the top to the bottom.
精彩评论