官术网_书友最值得收藏!

Using CMS in Debug Mode

When you start developing extensions of any kind for CMS Made Simple, a certain amount of your development time will involve tracking down things that aren't working the way you expect them to. Happily, CMS Made Simple has some built-in tools for helping in the debugging process.

This recipe shows you how to run CMS Made Simple in debug mode, and gives you some idea of what to look for in debug output.

How to do it...

  1. Find your CMS Made Simple base install directory. Within that directory will be your install's config.php file.
  2. Edit config.php and locate the following section
    # CMSMS Debug Mode? Turn it on to get a better error when you
    # see {nocache} errors, or to allow seeing php notices, warnings, and errors in the html output.
    # This setting will also disable browser css caching.
    $config['debug'] = false;
    
  3. Change the "false" to "true" and save the file.
  4. Browse through your site. At the bottom of each page will be the debug information:

How it works...

Debug mode causes CMS Made Simple to do a number of things differently than in normal production mode:

  1. PHP error reporting is changed to E_ALL, so warnings and errors will all be displayed.
  2. Page and CSS caching is disabled.
  3. Page redirecting via the API is disabled; instead, a link is displayed that will lead to the original destination.
  4. All database interactions are displayed.
  5. Select core functions display diagnostic information

Often, the display of otherwise hidden warnings or errors will be sufficient for you to track down issues by revealing problems like typos in variable names, missing parentheses, or other syntax errors.

The display of database interactions is useful for diagnosing query problems. Ideally, of course, all extension code we write has proper error checking and reporting. If, however, our code isn't that robust (or if we're still in early development, when such error handling has not yet been added), debug mode helps us identify problems.

See also

  • Chapter 10, Setting Special Diagnostic Messages for Debug Mode recipe
主站蜘蛛池模板: 读书| 济阳县| 西宁市| 霸州市| 西贡区| 聂荣县| 太和县| 汉阴县| 大丰市| 乌兰县| 蒲江县| 当阳市| 渭源县| 集贤县| 广德县| 库车县| 都昌县| 麻江县| 平陆县| 乐陵市| 长寿区| 巴塘县| 西吉县| 榆中县| 巫溪县| 三亚市| 沙雅县| 清涧县| 昭觉县| 长阳| 疏附县| 英德市| 台山市| 清丰县| 山东省| 长阳| 云龙县| 兴义市| 普安县| 鸡西市| 彰化市|