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 Pretty URLs in your module


When people first build a site using CMS Made Simple, they are often excited by how easy it is to make page URLs search-engine friendly. But then, sometimes, they are surprised or disappointed when they add a module, and see links that contain all sorts of opaque identifiers and control strings. People quickly learn to turn on "Pretty URLs", that make those module links look a lot less ugly.

When you implement a module, you might think that using the API to create links will automatically create Pretty URLs for you. Unfortunately, it's not that simple. The good news is that it's not hard to create Pretty URLs, but you do need to know which steps to take. This recipe shows you exactly what you need to do.

How to do it...

  1. 1. Using any of the methods described in Chapter 4, Getting Started with Modules create a new plug-in type module stub for your hiker's guide module, and call it "Hikes".

  2. 2. Add the following method to Hikes.module.php:

    function SetParameters...