O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

MODx Web Development

Book Description

Building dynamic websites with the PHP application framework and CMS

  • Simple, step-by-step instructions detailing how to install, configure, and customize MODx

  • Covers detailed theory from the basics, to practical implementation

  • Learn the most common web requirements and solutions, and build a site in the process

In Detail

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 with 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 functionalities. The generic nature of the snippets makes it possible to get the perfect customization that is so hard in other content management systems.

This book will get web developers up-and-running with MODx. With step-by-step examples and illustrative screenshots, you will be guided through installation, configuration, and customization. By the end of the book, you will have created a powerful, dynamic website by using the individual elements of MODx, without the need for programming know-how.

Starting with a walk-through of installing MODx, you will quickly learn how to develop your site without having to use any programming language. Logical, step-by-step instructions will show you how to create your own unique site by adding and editing documents using the inbuilt TinyMCE editor. Change the look and feel of your site by creating your own templates using HTML, CSS, and widgets. By following the example of a blog site, you will learn how to extend your templates to allow rich user interactions through comments, posts, and forms. The book teaches a few core snippets such as Ditto and Wayfinder in detail. These powerful and flexible snippets will enable you to add multiple functionalities to your site. The book will also introduce you to many more snippets which will help you build some of the commonly required web functionalities such as forums and image galleries. Manage your users with authentication and authorization and make your site user-friendly with user groups, forums, and the use of PHx notations to embed logic in templates.

Through following this easy-to-use, step-by-step guide, by the end of the book you will have a fully functional, feature-rich MODx site with professional-looking, dynamic web pages that are totally customizable.

Table of Contents

  1. MODx Web Development
    1. Table of Contents
    2. MODx Web Development
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code for the book
        2. Errata
        3. Piracy
        4. Questions
    7. 1. What is MODx?
      1. Content management system
                1. Manage content
                2. Content management rules
                3. Define content
      2. An application framework
        1. Reusable program components
        2. Abstracting logic from presentation
      3. Web development methodologies
        1. Old school—conventional three tiers
          1. Advantages of the conventional three tiers
          2. Disadvantages of the conventional three tiers
        2. Templating
          1. Advantages of templating
          2. Disadvantages of templating
        3. Application frameworks
          1. Advantages of application frameworks
          2. Disadvantages of application frameworks
        4. Content management systems
          1. Advantages of content management systems
          2. Disadvantages of content management systems
      4. Why MODx?
        1. Why a CMS?
        2. Why an application framework?
        3. So, why Modx?
      5. Overview of the book
      6. Summary
    8. 2. Getting Started
      1. Setting up the development environment
        1. Prerequisites
          1. Linux
          2. Windows
          3. MAC
        2. Verification
      2. Downloading MODx
        1. Installing MODx
          1. Creating a database
          2. Starting the installation
          3. Installation status and diagnostics
      3. Documentation
        1. Official documentation
        2. Community-driven documentation
      4. Getting support
        1. Web forums
        2. IRC
      5. Summary
    9. 3. MODx Basics
      1. Site configuration
        1. Configuring the site
        2. Default Manager interface page
        3. Noticing and fixing errors and warnings
      2. Changing the name of the site
      3. The basic element of MODx: Documents
        1. Containers
      4. MODx Manager interface
      5. Using the HTML editor
      6. Creating the Front Page
      7. QuickEdit module
      8. Documents revisited
        1. Editing documents
        2. Document properties
          1. General tab
          2. Page Settings
          3. Meta Keywords tab
          4. Preview tab
      9. Summary
    10. 4. Templating
      1. Changing the template of a document
      2. Creating a new template and giving it a category
        1. HTML
        2. CSS
        3. Steps to create the new template
      3. Making the Home Page use the created template
      4. Choosing a default template
      5. Introducing template variables
      6. Modifying the template to add dynamic behavior
        1. Changing existing templates
      7. Template variables
        1. Creating template variables
        2. Template variable values
        3. Data source binding
        4. Widgets
      8. Creating a blog site
        1. Creating a document
        2. Post a blog entry
      9. Snippet and chunk basics
        1. Generating output
      10. Using a custom form for the Post a Blog ! page
        1. HTML for the custom blog form
        2. Steps to create a chunk
        3. Using a chunk as a form template
        4. Checking the Post a Blog ! page
      11. Rich text editor for the blog content
        1. Creating the template variable
        2. Chunk and template variable
        3. NewsPublisher and the Rtcontent field
      12. Summary
    11. 5. Authentication and Authorization
      1. Create web users
        1. Other user properties
      2. Add the login snippet
      3. Document group for friends
      4. Restricting access for a document
        1. User group: Document group
        2. User: User group
      5. Post moderation
        1. Creating a role
        2. Creating a Manager user
        3. Checking the new role
      6. User registration
        1. Showing a signup form
        2. Joining a default group
        3. Link the signup form in the log in snippet
      7. Snippets and authorization
        1. NewsPublisher and authentication
      8. Summary
    12. 6. Content Aggregation
      1. Ditto
        1. More flexibility with parameters
        2. Aggregated data in a template
        3. Theming MODx—chunks and placeholders
        4. Introducing tagging
          1. Creating a template variable to hold the category
          2. Assigning documents to a category
      2. XML formats
        1. Machine-readable formats and readers
        2. Readers
        3. Formats
        4. Ditto and XML formats
          1. Creating RSS views for each category
        5. Filtering
          1. Multiple clauses
        6. Extenders
      3. Summary
    13. 7. Creating Lists
      1. Menu details in document properties
      2. Authentication and authorization
        1. Getting to know WayFinder
      3. Theming
        1. Creating a simple menu
        2. Nested menus
        3. Changing the name in the menu
        4. Doc Manager
          1. Removing pages from the menu
      4. More theming using chunks
        1. Breadcrumb navigation
      5. Multiple calls
      6. Summary
    14. 8. Snippets
      1. Working of snippets
      2. Finding snippets
      3. Learning about snippets
        1. Jot with the minimal configuration
        2. Snippet parameters
        3. Placeholders
      4. Using non-bundled snippets
        1. Installing a snippet
          1. Downloading and extracting a snippet
          2. Adding a snippet
          3. Copying required files
          4. Using the snippet
          5. Snippet without dependent files
        2. Snippeting skills
      5. Summary
    15. 9. PHx
      1. PHx in action
        1. Installing PHx
        2. Adding Family and Friends documents
      2. The PHx notation
        1. Simple usage
        2. Conditional statements
        3. Usage with the PHx placeholder
        4. Multiple conditions
        5. Summary
    16. 10. Simple Recipes
      1. Forums
        1. Installing SMF
        2. Installing the SMF module
      2. Image gallery
      3. Emailing from forms
      4. User profiles
        1. Installing WebLoginPE
        2. Edit profile
        3. List users and view profile
        4. Link to edit profile
      5. Similar posts
      6. Summary
    17. 11. Creating Snippets
      1. Learning to create a snippet
        1. Returning an output
        2. Returning placeholders
        3. Processing a chunk
        4. Using parameters
      2. MODx API
        1. DBAPI
          1. $MODx->db->select
          2. $MODx->db->getRecordCount
          3. $MODx->db->makeArray
      3. Fortunes
        1. Creating the table
        2. Code for fortunes
        3. Testing the snippet
        4. Chunks, placeholders, and parameters
        5. Using files
      4. Summary
    18. 12. SEO, Deployment, and Security
      1. SEO
        1. Search engine-friendly URLs
        2. Meta tags and keywords
        3. Site map
        4. XHTML Strict
        5. Other SEO tweaks
          1. Using CSS to control the layout
          2. Content first
          3. Hidden text
          4. Descriptive text
          5. Tracking
          6. Inbound links
          7. Quality content
      2. Deployment
        1. Filesystem
          1. FTP
          2. SFTP
          3. WebDAV
        2. Database
          1. Exporting
          2. Importing
          3. Configuration file
        3. Configurations
      3. Security
        1. File permissions
        2. Installer
        3. Writable configuration file
        4. Captcha
        5. mod_security
        6. Unused files
        7. Manager configurations
          1. User tab
          2. File Manager tab
      4. Summary
    19. 13. Plug-ins and Modules
      1. Plug-ins and events
        1. Using an existing plug-in
          1. Configuration
          2. System events
          3. Exploring other plug-ins
        2. Using custom plug-ins
          1. Learning about the plug-in
        3. Creating plug-ins
        4. Event-triggering snippets
      2. Modules
        1. Using modules
          1. Creating a module
          2. Executing a module
          3. Module's Manager interface
          4. Dependent plug-ins
        2. Learning to use custom modules
      3. Summary
    20. Index