Book Image

Building Websites with ExpressionEngine 2

By : Leonard Murphy
Book Image

Building Websites with ExpressionEngine 2

By: Leonard Murphy

Overview of this book

<p>ExpressionEngine is a flexible, feature-rich content management system used by top designers and web professionals across the world to build and manage their websites. It is written in the world's most popular web scripting language, PHP, and built on the MySQL database server. Are you eager to start creating websites with ExpressionEngine?<br /><br />Written for ExpressionEngine version 2.1 and later, this book will give you clear, concise, and practical guidance to take you from the basics of setting up ExpressionEngine to developing the skills you need to create ExpressionEngine websites to be reckoned with.<br /><br />You will begin with setting up a basic installation of ExpressionEngine. You will then learn how it works, before learning how to create and manage your website in ExpressionEngine. As you progress further into the book you will learn how to build an events calendar and how to build a photo gallery and before you know it, visitors to your website will be able to post comments, search your content, sign-up for a mailing list, and even send their friends an e-mail. As you consider the benefits of buying this book, you will learn how to manage members and member groups, how to optimize your website and avoid repetition, how to remove the index.php file for cleaner URLs, and how to take backups. At the end of the book, you will learn how to update ExpressionEngine to its latest version.</p>
Table of Contents (17 chapters)
Building Websites with ExpressionEngine 2
Credits
About the Author
About the Reviewers
Preface
Solutions to Exercises

Avoiding repetition


You have already created an embedded template that saves you from having lots of templates with the same basic HTML code inside. When working with templates in ExpressionEngine, it's best to avoid code repetition of code as much as possible — whether the repetition is within a single template or across multiple templates.

Any situation where code is repeated can be a major headache, should you ever wish to update that code; instead of being able to make an update in a single location, you instead have multiple places to make the same update, increasing the likelihood that you miss one. On a small site with only one or two templates, it's easy to manage code that is repeated, but as your site grows, having the same code in more than one template can make changes very difficult and time-consuming to accomplish.

ExpressionEngine has four ways to reduce repetition:

  1. 1. Preload text replacements

  2. 2. User-defined global variables

  3. 3. Snippets

  4. 4. Embedded templates

Each of these methods...