Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MODx Web Development - Second Edition

You're reading from  MODx Web Development - Second Edition

Product type Book
Published in Feb 2011
Publisher Packt
ISBN-13 9781849513487
Pages 288 pages
Edition 1st Edition
Languages
Toc

Table of Contents (19) Chapters close

Credits
About the Author
About the Reviewers
1. www.PacktPub.com
2. Preface
1. What is MODx? 2. Getting Started 3. MODx Basics 4. Templating 5. Authentication and Authorization 6. Content Aggregation 7. Creating Lists 8. Snippets 9. PHx 10. Simple Recipes 11. Creating Snippets 12. SEO, Deployment, and Security 13. Plugins and Modules 14. MODx Revolution

Preface

MODx is a content management system and PHP web application framework rolled into one. With the ease of a CMS and the extensibility of a framework, MODx allows you to develop professional-looking, intricate websites via its easy-to-use interface and flexible architecture. MODx provides reusable code called snippets, most of which are so generic that, without any modification, they can serve multiple purposes. The generic nature of snippets makes it possible to achieve the perfect customization that is so hard to achieve with other CMSes. This book will have web developers up-and-running with MODx. With the use of step-by-step examples and illustrative screenshots, you will be guided through installation, configuration, and customization of MODx. By the end of the book, you will have created a powerful, dynamic website by using the individual elements of MODx, and without the need for programming know-how.

What this book covers

Chapter 1, What is MODx: In this chapter, you learn the general concepts of web development, and also been assured as to why MODx, as a tool, is a good choice for developing your website. The various development methodologies, especially a CMS and a Web Application Framework are explained. With these briefings on the fundamentals, you will have a clear understanding of what MODx is and why you would want to use it.

Chapter 2, Getting Started: In this chapter, you learn how to set up a working platform for developing websites with MODx that includes the installation and configuration of the prerequisites such as Apache, PHP, and MySQL. To make the process easier, you will use XAMPP, which is a bundle containing all of these packages. Finally, you will install MODx and will verify that everything is set and ready.

Chapter 3, MODx Basics: In this chapter, you learn about resources and containers and how every page that is displayed gets it's content from a resource. You also learn to create, edit, and manipulate resources and manage their configurations, and also receive an explanation of the TinyMCE editor. This chapter also explains each and every configuration option available for documents, and also the general configurable options of the site. Finally, you create a Front Page by using what you have learned, and are introduced to the convenience of the DocManager.

Chapter 4, Templating: In this chapter, you learn about templates, how to create and add them, and the flow of rendering. We learn about template variables and resource specific variables, data types, Widgets, data sources, snippets, and chunks. You also create a template for the site, a snippet from the web, blog functionality, a custom form template for the blog page, and a rich text editor for the blog.

Chapter 5, Authentication and Authorization: In this chapter, you will learn how MODx facilitates authentication and authorization. You will build your site to include user registrations, logins, and user types, and will also set rules on who can do what.

Chapter 6, Content Aggregation: In this chapter, you learn about one very useful snippet, called Ditto. You see how to create aggregation and feeds, and how to create feeds for separate categories. You also learn about tagging and how to tag resources and use them in MODx.

Chapter 7, Creating Lists: In MODx, the simplest way to create lists of all of the resources is by using the [[wayfinder]] snippet. In this chapter, you learn how MODx allows us to create these lists dynamically, and you also learn how to present these lists as menus.

Chapter 8, Snippets: In this chapter, you learn how to use the hundreds of snippets that available, and in detail learn how to use a snippet and navigate its custom functionalities. You also learn how to search for snippets that do not come packaged with MODx, and how to use them. Along the way, you will add the functionality required to post comments and to navigate posts via their posting date.

Chapter 9, PHx: In this chapter, you learn how to format the values in template variables, and also see how to make conditional decisions based on the value of template variables, and accordingly present a different output either from the HTML in the expression or from a chunk or snippet.

Chapter 10, Simple Recipes: In this chapter, we will use what we have already learned to study how certain commonly-required functionalities can be implemented. We will learn how to integrate a forum, include an image gallery, and develop forms that can send mail, create web user profiles, and identify similar posts for blogs.

Chapter 11, Creating Snippets: In this chapter, you learn how to create snippets and the different ways of rendering their output. You also learn how to use the available MODx APIs as well as why you should use them. You create a new snippet for the site to display a random fortune. The snippet accepts a parameter for a chunk and renders the output by using chunks and placeholders. You also learn how snippets can make use of external files.

Chapter 12, SEO, Deployment, and Security: In this chapter, you learn how to optimize the site for search engines. You learn about clean URLs, meta tags, site maps, and other tweaks. Having developed the site on a local machine, you learn, in this chapter, how to deploy it to a remote server. Finally, you look into what has to be done in order to make your MODx site secure.

Chapter 13, Plugins and Modules: In this chapter, you learn about plugins and modules. You learn how to use plugins and how to customize plugins. You also learn how to create new plugins, and analyze the code of the prettify code plugin. Finally, you learn how to use modules by using the Autolink module and plugin.

Chapter 14, MODx Revolution: In this chapter, you take a quick look into MODx Revolution, to understand when to upgrade, what to expect, and how to contribute.

What you need for this book

No knowledge of PHP programming or any templating language is needed, but the more advanced chapters towards the end of the book will allow more confident developers to extend their applications even further by creating their own snippets. Software required for this book is only the LAMP Stack and, of course, the MODx installation.

Who this book is for

This book is ideal for newcomers to MODx. Both beginners and experienced web developers will benefit from this comprehensive guide to MODx. The more advanced chapters towards the end of the book will allow more confident developers to extend their applications even further by creating their own snippets.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can set this right by passing the value of the new template variable using the rtcontent parameter."

A block of code is set as follows:

<body>
<div id="banner">
<h1>Learning MODx</h1>
</div>
<div id="wrapper">
<div id="container">
<div id="content">
[*pagetitle*]
<br/>
[*#content*]
</div>
</div>
<div class="clearing"></div>
</div> <!-- end of wrapper div -->
<div id="footer">It is fun and exciting to build websites with MODx</div></body>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<div id="wrapper">
<div id="container">
<div id="content">
[*#content*] <!-- This is the only line that is not HTML. It is explained in the sections below. -->
</div>
</div>
<div class="clearing"> </div>
</div> <!-- end of wrapper div -->

Any command-line input or output is written as follows:

scp index.php username@remotemachineaddress:/foldername

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the Go button to import the database."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Note

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}