Book Image

CMS Made Simple Development Cookbook

Book Image

CMS Made Simple Development Cookbook

Overview of this book

CMS Made Simple has great capabilities “out of the box,” but one of its great strengths is the ease of extending those capabilities. You can add a surprising amount of functionality just by customizing the core modules, but once you learn to write your own tags and modules, your ability to add features is virtually limitless.CMS Made Simple Development Cookbook will show you how to use custom PHP code to extend the power and features of CMS Made Simple, and make it do exactly what you want. This easy to use guide contains clear recipes that introduce the key concepts behind each approach to extending the CMS, while also providing examples of solutions to real-world problems.You will learn the differences between the various kinds of tags and modules in the CMS Made Simple environment, and to which purposes each is best fit. Each technology is then explored in detail with a series of practical recipes and examples.You will not only learn the basics of creating tags and modules, but you will explore the underlying APIs that you will use to solve real-world website problems. You will become proficient with the database and form APIs, so that the code you write is portable and maintainable. You'll learn to localize your code and use templates to add its flexibility. You'll master the safe handling of parameters and the creation of secure code. You’ll be familiar with the CMS Made Simple Developer's Forge, and how you can use it in conjunction with revision control as a community-focused code management system, complete with web-based bug tracking and feature requests. You will learn to code complex interactions between modules, both directly and via the creation and handling of events. You will gain exposure to an array of advanced tips and tricks, along with commentary from the distilled experience of someone who has written dozens of modules. The CMS Made Simple Developer's Cookbook offers an amazing wealth of knowledge in approachable, bite-sized recipes. Whether you're new to the CMS or an old hand, you're sure to find valuable tips and information that will have you creating a richer CMS.
Table of Contents (16 chapters)
CMS Made Simple Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

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. 1. Find your CMS Made Simple base install directory. Within that directory will be your install's config.php file.

  2. 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. 3. Change the "false" to "true" and save the file.

  4. 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. 1. PHP error reporting is changed to E_ALL, so warnings and errors will all be displayed.

  2. 2. Page and CSS caching is disabled.

  3. 3. Page redirecting via the API is disabled; instead, a link is displayed that will lead to the original destination.

  4. 4. All database interactions are displayed.

  5. 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